You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrated issue, originally created by Michael Bayer (@zzzeek)
from sqlalchemy import *
m = MetaData()
t = Table(
't', m,
Column(
'x', Integer, primary_key=True)
)
e = create_engine("postgresql://scott:tiger@localhost/test", echo=True)
m.drop_all(e)
m.create_all(e)
e.execute("alter table t alter column x type varchar(50)")
m2 = MetaData()
t2 = Table('t', m2, autoload_with=e)
from sqlalchemy.schema import CreateTable
print CreateTable(t2)
output:
sqlalchemy.exc.ArgumentError: Column type VARCHAR(50) on column 't.x' is not compatible with autoincrement=True
The text was updated successfully, but these errors were encountered:
Don't set pg autoincrement if type affinity is not Integer
Postgresql table reflection will ensure that the
:paramref:.Column.autoincrement flag is set to False when reflecting
a primary key column that is not of an :class:.Integer datatype,
even if the default is related to an integer-generating sequence.
This can happen if a column is created as SERIAL and the datatype
is changed. The autoincrement flag can only be True if the datatype
is of integer affinity in the 1.1 series.
This bug is related to a test failure in downstream sqlalchemy_migrate.
Migrated issue, originally created by Michael Bayer (@zzzeek)
output:
The text was updated successfully, but these errors were encountered: