class BudgetCategories(Base): __tablename__ = 'budget_categories' # ... # @note: new __table_args__ = ( CheckConstraint('NOT(category IS NULL AND parent_category IS NULL)'), )