I should have also indicated that the addition of sqlalchemy.sql.text fixes
the small mixin example. The little script below works, but I don't know
if it is a sketchy hack, or a safe long term solution:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy.sql import text as sql_text
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_type2", "track_type",
postgresql_where = sql_text("track_type != 0")),
)
class A_Model(Base, A_TableDef):
pass
e = create_engine("postgresql://postgres:postgrespw@localhost:5433/edms",
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 [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.