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
classBase(DeclarativeBase):
passclassUser(Base):
__tablename__="users"__table_args__= {"schema": "app"}
# Not a real column - just here to satisfy SQLAlchemy's requirement for a primary key for every tableid: Mapped[int] =orm.mapped_column(
BigInteger, primary_key=True, autoincrement=True
)
email: Mapped[Optional[str]] =orm.mapped_column(String)
FlushError: Instance <User at 0xffff90209d30> has a NULL identity key. If this is an auto-generated value, check that the database table allows generation of new primary key values, and that the mapped Column object is configured to expect these generated values. Ensure also that this flush() is not occurring at an inappropriate time, such as within a load() event.
The text was updated successfully, but these errors were encountered:
Example:
The following code fails:
The text was updated successfully, but these errors were encountered: