Re: [sqlalchemy] Re: get raw sql for create type and tables

2011-10-29 Thread Michael Bayer
OK I rearranged how PG does "checkfirst", to only process a particular named ENUM type once within a particular create/drop sequence without needing to check the DB, so the "checkfirst" flag can now be honored normally. This is in rde4eb56fb6c8 and you can get this at http://hg.sqlalchemy.org/

Re: [sqlalchemy] Re: get raw sql for create type and tables

2011-10-28 Thread Michael Bayer
I can make a ticket for this since the Enum type is using the deprecated event system and PG's event here doesn't have access to the "checkfirst" flag. Ticket #2311. For now you'd have to not use the "native" enum type with PG, or patch out that "checkfirst=True" inside of postgresql/base.p

[sqlalchemy] Re: get raw sql for create type and tables

2011-10-28 Thread lestat
If I do this: from sqlalchemy import * from StringIO import StringIO buf = StringIO() pg_engine = create_engine('sqlite://', strategy='mock', executor=lambda s,p=';': buf.write(s.__str__() + p)) buf.truncate(0) tables = [x[1] for x in sorted(db.metadata.tables.items(), key=lambda x: x[0])] for tab

[sqlalchemy] Re: get raw sql for create type and tables

2011-10-28 Thread lestat
I need print this sql code if these ENUM types and tables and indexes exist. On 28 окт, 18:28, lestat wrote: > How I can get raw sql for this table? > > class Test(db.Model): >     __tablename__ = 'test' > >     id = db.Column(db.Integer, primary_key=True) >     birthday = db.Column(db.Date) >