Hi,

What is the recommended method of specifying constraints on columns
added by a subclass using single-table inheritance? This does not work,
I get a KeyError for "col_a":

class BaseClass(Base)
    __table__ = "base"
    __table_args__ = (Index("base_col"),
                      UniqueConstraint("col_a", "col_b"))

    base_col = Column(Integer)

class SubClass(BaseClass):
    col_a = Column(Integer)
    col_b = Column(Integer)

SQLA does not allow __table_args__ placed on SubClass. I can do a
workaround by using BaseClass.__table__.append_constraint() after
defining SubClass, but mixing different ways of defining constraints
does not look nice.

Gabor

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to