primary key concealment with sqlite autoincrement not implemented correctly

Issue #1812 resolved
Mike Bayer repo owner created an issue
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)

  1. Log in to comment