Re: [sqlalchemy] group_by by the result of some other query

2011-08-11 Thread Andrew Taumoefolau
Hi Eduardo, group_by accepts strings, so this is certainly possible. You might do it like so: # build our column names query column_names = session.query(tab.c.name).filter(tab.c.value==354) # execute and a build a list of strings from our query column_names = [column_name for (column_name,) in

[sqlalchemy] Feature request: Multilevel inheritance mapping

2011-08-11 Thread Fayaz Yusuf Khan
I was trying to configure a multilevel inheritance mapping (either using joint- table or single-table) but it didn't work as I was expecting it to. I understand that it probably has never been thought of, but in my particular use case, it would have been really handy. Any idea if this is

[sqlalchemy] Ho do I syncronize ORM objects when working with multiple sessions?

2011-08-11 Thread Massi
Hi everyone, in my script I work with two different sessions (say session1 and session2) bounded to the same database and, consequently, with ORM objects obtained with queries issued on them. It can occur that an object related to session1 change a value of the corresponding mapped table record

[sqlalchemy] Re: group_by by the result of some other query

2011-08-11 Thread Eduardo
Hi Thanks for the answer, This is my query column_names = session.query(tab.c.name).filter(tab.c.value==354) column_names = [column_name for (column_name,) in column_names] query=sess.query(func.max(tab.columns['name']),datab.columns['article_id']).group_by(*column_names).all() I get an error

Re: [sqlalchemy] Feature request: Multilevel inheritance mapping

2011-08-11 Thread Michael Bayer
multilevel sounds like you mean this: class A: class B(A): class C(B): class D(C): That's supported fully in all cases, and for single/joined should work without any special steps (for concrete its slightly more weird). If this is not working then we can get you going with some test cases.

[sqlalchemy] joining to a from_statement

2011-08-11 Thread NiL
Hi list, I'm using SA 0.6.7, Python 2.6.5 and Postgres 8.4 on Ubuntu 10.04 LTS I'm trying to optimize my code against postgres by using the recursive statements CTE as documented here : http://www.postgresql.org/docs/8.4/interactive/queries-with.html My model is a group graph ( many to many

Re: [sqlalchemy] joining to a from_statement

2011-08-11 Thread Michael Bayer
On Aug 11, 2011, at 12:31 PM, NiL wrote: Hi list, I'm using SA 0.6.7, Python 2.6.5 and Postgres 8.4 on Ubuntu 10.04 LTS I'm trying to optimize my code against postgres by using the recursive statements CTE as documented here :

[sqlalchemy] mysql table creation errno 105 when using vertical partitioning with InnoDB

2011-08-11 Thread Daniel Robbins
Hi there, I have been using ORM vertical partitioning for a while with MySQL 5.1.58 and MyISAM tables and SQLAlchemy 0.7.2. I have recently switched over to using InnoDB tables and my vertical partitioning table creation is failing part-way in with an errno 105 code. I have confirmed that all

Re: [sqlalchemy] Ho do I syncronize ORM objects when working with multiple sessions?

2011-08-11 Thread Michael Bayer
On Aug 11, 2011, at 5:46 AM, Massi wrote: Hi everyone, in my script I work with two different sessions (say session1 and session2) bounded to the same database and, consequently, with ORM objects obtained with queries issued on them. It can occur that an object related to session1 change

Re: [sqlalchemy] mysql table creation errno 105 when using vertical partitioning with InnoDB

2011-08-11 Thread Michael Bayer
On Aug 11, 2011, at 2:04 PM, Daniel Robbins wrote: Hi there, I have been using ORM vertical partitioning for a while with MySQL 5.1.58 and MyISAM tables and SQLAlchemy 0.7.2. I have recently switched over to using InnoDB tables and my vertical partitioning table creation is failing

Re: [sqlalchemy] mysql table creation errno 105 when using vertical partitioning with InnoDB

2011-08-11 Thread Daniel Robbins
On Thu, Aug 11, 2011 at 12:20 PM, Michael Bayer mike...@zzzcomputing.comwrote: Vertical partitioning implies tables in separate databases or schemas. It seems like you have it set up such that a table in partition A can refer to a table in partition B using a schema qualifier. So if this is

Re: [sqlalchemy] mysql table creation errno 105 when using vertical partitioning with InnoDB

2011-08-11 Thread Michael Bayer
On Aug 11, 2011, at 2:57 PM, Daniel Robbins wrote: based on the sample code in the O'Reilly book Just FYI the Oreilly book is super, duper, extremely old and out of date.A good read through the documentation on the SQLAlchemy site should be more complete at this point and up to date,

Re: [sqlalchemy] mysql table creation errno 105 when using vertical partitioning with InnoDB

2011-08-11 Thread Daniel Robbins
On Thu, Aug 11, 2011 at 2:12 PM, Michael Bayer mike...@zzzcomputing.comwrote: Just FYI the Oreilly book is super, duper, extremely old and out of date. A good read through the documentation on the SQLAlchemy site should be more complete at this point and up to date, also stressing a whole

Re: [sqlalchemy] Relationship spanning on multiple tables

2011-08-11 Thread neurino
Sorry if I bother again but adding some others relationships like this spanning on 5 tables: mapper(UserLayer, inherits=base_user_layer_mapper, polymorphic_identity=CLASS_LAYER, properties={ ... 'lca_transport': relationship(LCATransport,