On Jun 24, 2008, at 9:27 PM, bukzor wrote:

>
> Is there a way to print out the query as it would execute on the
> server? I'd like to copy/paste it into the server to get the 'explain'
> output, and the '%s' variables are very unhelpful here.

the string output of str(statement) is what's actually sent to the  
client lib.   In some cases, that is the actual string that goes to  
the server, such as cx_oracle, which receives the bind parameters  
separately within the network conversation.  The fact that MySQLDB and  
psycopg2 do an in-client "substitution" of the string before passing  
on is an implementation artifact of those libraries.

Feel free to construct the string yourself (this is specific to  
MySQL's bind param style):

stmt = str(statement)
compiled = statement.compile()
params = compiled.params
stmt = stmt % [params[k] for k in compiled.positiontup]


> I'd also like to turn off the 'alias and backtick-escape every column'
> default behavior if I can.

we don't "backtick every column".  We quote case sensitive idenfitier  
names, if that's what you mean, where "case sensitive" is any  
identifier that is spelled out in MixedCase - this is required for the  
column to be properly recognized by the database.  Use all lower case  
letters to indicate a "case insensitive" identifier.


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

Reply via email to