>
> > What is the proper way to declare a postgresql partial index when using 
> the @declared_attr decorator? 
>
> these two concepts aren’t really connected 
>

Sorry --  I described that poorly, then.  However, I only see the problem 
(in v0.9.8) when I am using @declared_attr as in the case of a mixin.

Your test script works for me, but not when I tweak it to have mixin 
behaviour.  Try this version:

from sqlalchemy import * 
from sqlalchemy.orm import * 
from sqlalchemy.ext.declarative import declarative_base, declared_attr 

Base = declarative_base() 

class A_TableDef(object): 
    __tablename__ = 'a' 
    id = Column(Integer, primary_key=True) 

    track_type       = Column(SmallInteger, nullable = False) 

    @declared_attr 
    def __table_args__(cls): 
        return (Index("idx_track_type", "track_type", 
                      postgresql_where = (cls.track_type != 0)), 
                ) 

class A_Model(Base, A_TableDef):
    pass

e = create_engine("postgresql://scott:tiger@localhost/test", echo =True) 

Base.metadata.drop_all(e) 
Base.metadata.create_all(e) 

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to