Re: [sqlalchemy] Column vs Table constraints for Column(unique=True) in Postgres

2015-05-20 Thread Lucas Taylor
Unless you provide a name, the constraint will be anonymously named, so there is no difference between that and the shortcut. Provide a name argument to UniqueConstraint: __table_args__ = (UniqueConstraint('alt_id', name='uq_alt_id'),) You may also be interested in providing a naming

[sqlalchemy] Re: Relationship query trouble

2015-03-15 Thread Lucas Taylor
You'll need to include questions for which there are no responses, so a left outer join with an appropriate filter should help. Something like this may point you in the right direction: user_id = 4 session.query(Question).\ outerjoin(Response).\ filter(or_( Response.id == None,

Re: [sqlalchemy] PostgreSQL 9.1 on the horizon, cool new stuff

2014-01-31 Thread Lucas Taylor
On Friday, January 31, 2014 7:45:07 AM UTC-7, Michael Bayer wrote: On Jan 30, 2014, at 9:52 PM, Lucas Taylor ltaylo...@gmail.comjavascript: wrote: Any notion of how one might instruct SQLAlchemy to (conditionally) create tables using UNLOGGED? I'd like to be able to modify the DDL

[sqlalchemy] Re: PostgreSQL 9.1 on the horizon, cool new stuff

2014-01-30 Thread Lucas Taylor
Any notion of how one might instruct SQLAlchemy to (conditionally) create tables using UNLOGGED? I'd like to be able to modify the DDL for all CREATE TABLE statements under certain conditions (dialect=postgresql testing=True) If not under test, then there would be no need to modify CREATE