-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I think that SQLAlchemy behaves incorrectly when there is a primary key
constraint on multiple columns and one of the columns is of type Integer.


##
from sqlalchemy import schema, types, create_engine

metadata = schema.MetaData()
test = schema.Table(
    'test', metadata,
    schema.Column('x', types.String, nullable=False),
    schema.Column('y', types.Integer, nullable=False),

    schema.PrimaryKeyConstraint('x', 'y')
    )

engine = create_engine('postgresql://...', echo=True)

try:
    metadata.create_all(engine)
finally:
    metadata.drop_all(engine)
##


The generated TABLE statament is:

CREATE TABLE test (
        x VARCHAR NOT NULL,
        y SERIAL NOT NULL,
        PRIMARY KEY (x, y)
)


In my opinion, autoincrement should be assumed to be true *only* when
there is one primary key of type Integer.


Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkuLA+4ACgkQscQJ24LbaUQpgQCeLMg6mdv1INCe0EgAxWipPeak
4lgAmwdZcQiVYv3JWL/quAVQb4WBwSef
=wgyS
-----END PGP SIGNATURE-----

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

Reply via email to