[sqlalchemy] postgresql EXCLUDE constraint

2010-09-23 Thread A.M.
Hello,

I am using this PostgreSQL exclusion constraint:

CONSTRAINT only_one_valid EXCLUDE USING (synthetic_id WITH 
=,COALESCE(obsoleteby,'') WITH =),

How can I represent this using SQLAlchemy Table metadata so that I can create 
the table from the metadata?

Cheers,
M

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] postgresql EXCLUDE constraint

2010-09-23 Thread Michael Bayer
custom DDL is most directly via the DDL() element:

http://www.sqlalchemy.org/docs/core/schema.html#sqlalchemy.schema.DDL

or if you want a more general use EXCLUDE construct that accepts arguments 
and SQL expressions you can subclass DDLElement and build a compilation 
function:

http://www.sqlalchemy.org/docs/core/compiler.html

DDL and DDLElement both support execution via table and metadata create/drop 
events.


On Sep 23, 2010, at 6:22 PM, A.M. wrote:

 Hello,
 
 I am using this PostgreSQL exclusion constraint:
 
 CONSTRAINT only_one_valid EXCLUDE USING (synthetic_id WITH 
 =,COALESCE(obsoleteby,'') WITH =),
 
 How can I represent this using SQLAlchemy Table metadata so that I can create 
 the table from the metadata?
 
 Cheers,
 M
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To post to this group, send email to sqlalch...@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.