[sqlalchemy] Re: Printing the SQL generated by table.create()

2008-07-09 Thread jason kirtland

Aaron Torres wrote:
 Hey all,
 
 I've been looking through the documentation and searching google for
 answers to this, but I can't seem to find a solution.
 
 if I set meta.bind.echo=True, I can see the SQL statement that is
 being generated when I call table.create(). Is there any way I can
 easily grab this sql statement and store it into a variable (as a
 string)? I know you can easily print the SQL generated for insert()
 commands etc, but I can't find an easy way to do this with creates.
 
 Sorry if I missed something obvious! Any help would be greatly
 appreciated.

There is a recipe in the FAQ:

http://www.sqlalchemy.org/trac/wiki/FAQ#HowcanIgettheCREATETABLEDROPTABLEoutputasastring

Cheers,
Jason

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Printing the SQL generated by table.create()

2008-07-09 Thread Michael Bayer

On Jul 9, 2008, at 1:09 PM, Aaron Torres wrote:


 Hey all,

 I've been looking through the documentation and searching google for
 answers to this, but I can't seem to find a solution.

 if I set meta.bind.echo=True, I can see the SQL statement that is
 being generated when I call table.create(). Is there any way I can
 easily grab this sql statement and store it into a variable (as a
 string)? I know you can easily print the SQL generated for insert()
 commands etc, but I can't find an easy way to do this with creates.

 Sorry if I missed something obvious! Any help would be greatly
 appreciated.

uh well you could read three messages up today since someone asked the  
identical question about two hours ago, the answer is still 
http://www.sqlalchemy.org/trac/wiki/FAQ#HowcanIgettheCREATETABLEDROPTABLEoutputasastring
 
  .


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Printing the SQL generated by table.create()

2008-07-09 Thread Aaron Torres

Ah my apologies,

Apparently the search terms I was using to find an answer weren't what
I needed!

In any case, thanks a lot! This is a real life saver.


On Jul 9, 11:13 am, Michael Bayer [EMAIL PROTECTED] wrote:
 On Jul 9, 2008, at 1:09 PM, Aaron Torres wrote:



  Hey all,

  I've been looking through the documentation and searching google for
  answers to this, but I can't seem to find a solution.

  if I set meta.bind.echo=True, I can see the SQL statement that is
  being generated when I call table.create(). Is there any way I can
  easily grab this sql statement and store it into a variable (as a
  string)? I know you can easily print the SQL generated for insert()
  commands etc, but I can't find an easy way to do this with creates.

  Sorry if I missed something obvious! Any help would be greatly
  appreciated.

 uh well you could read three messages up today since someone asked the  
 identical question about two hours ago, the answer is 
 stillhttp://www.sqlalchemy.org/trac/wiki/FAQ#HowcanIgettheCREATETABLEDROPT...
   .
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---