Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sqlalchemy one column of two has to be not null

class BudgetCategories(Base):
    __tablename__ = 'budget_categories'
    # ...

    # @note: new
    __table_args__ = (
            CheckConstraint('NOT(category IS NULL AND parent_category IS NULL)'),
            )
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sqlalchemy #column #null
ADD COMMENT
Topic
Name
2+4 =