Hi. I have found an insidious problem with SQLAlchemy and PostreSQL.
Here is an example: from sqlalchemy import engine, schema, sql, types metadata = schema.MetaData() a = schema.Table( 'a', metadata, schema.Column('id', types.Integer, primary_key=True), schema.Column('x', types.Integer), ) b = schema.Table( 'b', metadata, schema.Column('id', types.String, schema.ForeignKey(a.c.id), primary_key=True), schema.Column('y', types.Integer), ) URL = 'postgres://twisted_test:[EMAIL PROTECTED]/twisted_test' db = engine.create_engine(URL, echo=True) metadata.bind = db try: metadata.create_all() finally: metadata.drop_all() There is an error in the schema, b.id is of type String instead of type Integer. Unfortunately PostgreSQL does not raises an error, but just a warning. In fact I have found such a problem in one of my programs only after a pg_dump + pg_restore: WARNING: foreign key constraint "b_id_fkey" will require costly sequential scans DETAIL: Key columns "id" and "id" are of different types: text and integer. What's the best method to avoid these bugs? It would be nice to have something like `salint`, that can scan a metadata searching for problems. Also, it would help if PostgreSQL warnings messages can be reported by psycopg/SQLAlchemy. Better if warnings can be considered like errors, thus raising an exception (something like the Werror option in GCC). Thanks Manlio Perillo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---