I use declarative base for defining classes.

I have a constraint that only works in Postgres.  How do I declare
that constraint "lowername_check" only if the session is going
postgres (and not to sqlite, for example).

pg_only_constraint = CheckConstraint("lowername !~
'[[:upper:]]'",name='lowername_check'),
class Data(Base):
    __tablename__ = 'Data'
    lowername=Column(Unicode, nullable=False)
    __table_args__ = (
        pg_only_constraint,  {}
        )


Thanks!

Gregg Lind

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to