[sqlalchemy] 'ThreadLocalMetaData' support for 'schema'

2013-04-07 Thread Pedro Romano
Having to support different PostgreSQL schemas per web request and finding my current approach of setting the PostgreSQL schema search path a bit convoluted, when I try to use longer lived sessions in unit tests for convenience, because the session starts using a new database connection after

[sqlalchemy] Self-referencing augmented class

2013-04-07 Thread Alexey Vihorev
Hi! I've got this setup: cs = sqlite:///:memory: sa_engine = create_engine(cs) Base = declarative_base() class Person(Base): __abstract__ = True id = Column(Integer, primary_key=True) name = Column(String(30)) class Employee(Person): __tablename__ = 'employee'

Re: [sqlalchemy] 'ThreadLocalMetaData' support for 'schema'

2013-04-07 Thread Michael Bayer
we will be supporting this as a connection execution option in http://www.sqlalchemy.org/trac/ticket/2685, so the usage will be like: conn = connection.execution_options(default_schema=someschema) s = Session(bind=conn) work with Session or Connection for now the easiest approach is to set

Re: [sqlalchemy] ORM Join with Group By

2013-04-07 Thread Thijs Engels
Thank you very much for your effort in putting together a complete and working example. Much appreciated, Thijs On Sat, Apr 6, 2013, at 18:10, Audrius Kažukauskas wrote: Hi, Thijs, On Thu, 2013-04-04 at 21:36:56 +0200, Thijs Engels wrote: Assume a database with two tables; sessions and

Re: [sqlalchemy] Self-referencing augmented class

2013-04-07 Thread Michael Bayer
On Apr 7, 2013, at 8:27 AM, Alexey Vihorev viho...@gmail.com wrote: Hi! I’ve got this setup: cs = sqlite:///:memory: sa_engine = create_engine(cs) Base = declarative_base() class Person(Base): __abstract__ = True id = Column(Integer, primary_key=True) name

Re: [sqlalchemy] 'ThreadLocalMetaData' support for 'schema'

2013-04-07 Thread Pedro Romano
Thanks for the reply Michael. I had already done some experimentation with the 'Session.after_begin' event, so I think I'll revisit that for now, but #2685 looks like a very elegant solution, looking forward to that. --Pedro. On Sunday, 7 April 2013 15:44:55 UTC+1, Michael Bayer wrote: we

[sqlalchemy] composite ForeignKeyConstraint with a constant, non-column member?

2013-04-07 Thread YKdvd
I'm using SQLAlchemy on an existing database, with some one-many with the many row connecting to a many-many department/status system. The main fields are something like this: Parent.id Parent.mainStatus Child.id Child.parent_link Child.department_id Child.status_id Department.id

RE: [sqlalchemy] Self-referencing augmented class

2013-04-07 Thread Alexey Vihorev
Thanks! From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: Sunday, April 07, 2013 5:46 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Self-referencing augmented class On Apr 7, 2013, at 8:27 AM, Alexey Vihorev