this approach should work for now, but will need some small  
modifications in the next release of SA (i.e. it should be easier):

from sqlalchemy import *

class FakeDBAPI(object):
     def __init__(self):
         self.paramstyle = 'named'

e = create_engine('oracle://', module=FakeDBAPI())   # or  
postgres://, mysql://, etc.

def proxy(statement, params):
     print statement

gen = e.dialect.schemagenerator(e, proxy, None)

m = MetaData()
t = Table('table1', m, Column('id', Integer, primary_key=True))
t2 = Table('table2', m, Column('id', Integer, primary_key=True),  
Column('t1id', Integer, ForeignKey('table1.id')))

m.accept_visitor(gen)


On Mar 30, 2007, at 4:34 AM, ml wrote:

>
> Hi!
>
> I want meta.create_all() to generate and print the SQL only and don't
> query the DB. Is there any way?
>
> Thanks for advices.
>
> David
>
> >


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