Hello,

I have the following code, which sets UniqueConstraint using fields ("foo", 
"bar") from inherit class.     

from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy import Column, Integer, Unicode, UniqueConstraint

Base = declarative_base()


class Foo(object):

    foo = Column(Unicode(64), nullable=False)

    @declared_attr
    def bar(cls):
        return Column("bar", Integer)


class ItemCategory(Base, Foo):
    __tablename__ = 'item_category'

    id = Column(Integer, primary_key=True)
    name = Column(Unicode(64), nullable=False)

    __table_args__ = (
        UniqueConstraint(name, "foo", "bar",
                         name='unique_category_and_parent'),)Введите код...

It's work ok with sqlalchemy==0.9.9, but sqlalchemy>=1.0 raises an 
exception.
"foo" field work ok, "bar" defined with declared_attr raises KeyError.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to