On May 15, 4:37 am, Jan-Eric <jedu...@gmail.com> wrote:
> Hi!
>
> what approaches do you guys use to find syntax errors in very large
> sql statements.
>
> Usually, I build my statements joining several sqlalchemy select
> statements together to a single statement.
> It works great until if I make a (small) mistake (like forgetting an
> alias or other things ) , the exception that is raised in these cases
> is not helpful.
> For example, I might get "Not an executable clause: " error and then
> the complete 30+ lines plus sql statement.
> This approach is ok for small sql statements, but I really would like
> to know exactly the spot where the error occurs.

"not an executable clause" is easy, it only refers to the actual thing
you passed to execute().   It has to be a select(), update(),
insert(), etc.  I.e. you can't pass a table column or other fragment
to execute().   An alias() is fine for execute() as well (at least it
should be).   There's no need to dig into 30 lines of anything for
that, it occurred right at the top level.

Otherwise, the SQL expression language narrows down the possible set
of "syntax" to something very small - typos and incorrect names and
such aren't really possible.   The "alias missing" is one common
error, just look at the SQL for any pattern of (select ...) without an
AS following the last parenthesis.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to