- changed status to resolved
primary key concealment with sqlite autoincrement not implemented correctly
Issue #1812
resolved
from sqlalchemy import Table, Column, Integer, String, MetaData
from sqlalchemy import ForeignKey, create_engine
metadata = MetaData()
table1 = Table('table1', metadata,
Column('id', Integer, primary_key = True),
Column('fid', Integer, ForeignKey('table2.id')),
sqlite_autoincrement = True)
table2 = Table('table2', metadata,
Column('id', Integer, primary_key = True),
Column('stuff', String), sqlite_autoincrement = True)
engine = create_engine('sqlite://', echo = True)
metadata.create_all(engine)
output:
CREATE TABLE table2 (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
stuff VARCHAR
)
CREATE TABLE table1 (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
fid INTEGER,
,
FOREIGN KEY(fid) REFERENCES table2 (id)
)
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.6.1 (automated comment)
- Log in to comment
035ec314f63bd03de11eeac7c52c852674c7ce29