[Sqlalchemy-tickets] Issue #3453: custom sequency not attached to primary key for PostgreSQL (zzzee
Brought to you by:
zzzeek
|
From: Gijs M. <iss...@bi...> - 2015-06-16 11:59:46
|
New issue 3453: custom sequency not attached to primary key for PostgreSQL https://bitbucket.org/zzzeek/sqlalchemy/issue/3453/custom-sequency-not-attached-to-primary Gijs Molenaar: When I supply a primary key a custom Sequence the sequence is created but not attached to the primary key column. Tested only with PostgreSQL and SQLAlchemy 1.0.5 example code ``` #!python from sqlalchemy import Column,Integer, Sequence from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine Base = declarative_base() class TestCustomSeq(Base): __tablename__ = 'testseq' id = Column(Integer, Sequence('customseq'), primary_key=True) alchemy_engine = create_engine('postgresql://gijs:gijs@localhost:5433/gijs', echo=True) Base.metadata.create_all(alchemy_engine) ``` generated sql: ``` #!sql CREATE SEQUENCE customseq COMMIT; CREATE TABLE testseq ( id INTEGER NOT NULL, PRIMARY KEY (id) ); ``` |