by divbzero · 2y ago · 0 comments
id = Column(String, primary_key=True, default=str(uuid.uuid4()), unique=True, nullable=False)
Can be fixed by making the default a function: id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()), unique=True, nullable=False)
Or, if you choose to use native UUID types in Python and SQL: id = Column(Uuid, primary_key=True, default=uuid.uuid4, unique=True, nullable=False)No comments yet.