[Sqlalchemy-tickets] [sqlalchemy] #2886: Add an officially supported query compilation function
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-12-11 14:07:38
|
#2886: Add an officially supported query compilation function
-------------------------+-----------------------------------------
Reporter: agronholm | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone:
Component: utils | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
-------------------------+-----------------------------------------
Often, when my queries are not accepted by the backend (ProgrammingError)
I want to look at the generated SQL and tinker with it, executing it
directly on the backend until I figure out what's wrong. Trouble is, when
I print the query with str(query), it gives me the non-interpolated
version of the query (ie. with the placeholders not filled in). Many
people have been asking for a way to get a compiled version of the query,
which could be copypasted directly to psql or whatever.
SQLACodegen also requires a method for compiling expressions, given a
dialect.
I've used an adapted version of this:
http://stackoverflow.com/a/5698357/242021
However, the 0.8.3 update broke it. One of my tests is now giving me:
{{{
AttributeError: Neither 'Label' object nor 'Comparator' object has an
attribute 'table'
}}}
That's one more reason why I'm requesting an official compiling method
that won't break with micro version updates of SQLAlchemy.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2886>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|