I have a number of tables in different schemas, I used the pattern from the docs. Some of my tables require multi column constraints and it was unclear what the dictionary key would be for declaring that unique constraint as they mention in the section above
In my model below, I'd like to create a unique constraint with name, key, org. I currently have to do this in sql...
class Parent(Base):
__tablename__ = 'parent'
__table_args__ = {'schema': 'example'}
id = Column(Integer, primary_key=True)
name = Column(String(512))
key = Column(String())
org = Column(String(36))
from SQLAlchemy multi column constraint
No comments:
Post a Comment