📜  主键 qlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL 约束失败 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:52.122000             🧑  作者: Mango

代码示例1
# SQLAlchemy does not map BigInt to Int by default on the sqlite dialect.
# It should, but it doesnt.
from sqlalchemy import BigInteger
from sqlalchemy.dialects import postgresql, mysql, sqlite

BigIntegerType = BigInteger()
BigIntegerType = BigIntegerType.with_variant(postgresql.BIGINT(), 'postgresql')
BigIntegerType = BigIntegerType.with_variant(mysql.BIGINT(), 'mysql')
BigIntegerType = BigIntegerType.with_variant(sqlite.INTEGER(), 'sqlite')

# Then replace db.BigInteger with BigIntegerType