I've been using the "literalquery" function as described in the top answer 
on this Stackoverflow page for the past year or so: 
 http://stackoverflow.com/questions/5631078/sqlalchemy-print-the-actual-query

I found it very easy to add extra types to it.  It has been really handy. 
 I use it in practically every SQLAlchemy development project that ends up 
involving complicated queries.  The more complicated the query, the more 
likely I am to really need this capability.

It helps to troubleshoot the query and to run explain plans in the database 
for optimizing the query as well.

Lastly, I use it to provide an audit trail for what queries were run, and 
when.

--


Recently I started getting this error:

statement._mapper_zero_or_none()
AttributeError: 'Query' object has no attribute '_mapper_zero_or_none'

I'm thinking something changed in one of the 1.0.x releases that removed or 
broke the _mapper_zero_or_none function.  Is that true? (or did I break 
something else in my script that tis error is hiding?)   I have not found 
anything that even describes what this function does in the online 
documentation or by Google or DuckDuckGo searching.  I'll search the source 
next, I suppose, but thought I'd ask and get the question out there in case 
anyone else bumps into the same issue.

@zzzeek states that this particular function is unnecessary in the comments 
on the stackoverflow discussion, but doesn't really explain why or how to 
remove it:

"""this solution in no way accurately represents what's involved to 
stringify a statement. the reaching intio _mapper_Zero_or_none and attempts 
to locate "bound" metadata are all completely unnecessary. The overriding 
of Compiler is also a hack that overlooks documented APIs. I'll provide an 
answer shortly. – zzzeek <http://stackoverflow.com/users/34549/zzzeek> May 
23 '14 at 17:42 
<http://stackoverflow.com/questions/5631078/sqlalchemy-print-the-actual-query#comment36675387_5698357>
"""

I don't have a stackoverflow account with enough points to be able to 
comment and ask the question there.

--
Rick.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to