[sqlalchemy] Re: Replacing columns in a Select

2012-03-15 Thread rdunklau
Thank you, I did not think of with_only_columns for the last part. The part that bother me the most is how to build the column list. I rewrote my code to only use public attributes and methods: columns = ColumnCollection(*myselect.inner_columns) columns.replace(my_column)

[sqlalchemy] Returningquery results with the result number

2012-03-15 Thread Eduardo
Hi, In order to avoid bottlenecks I am force to limit the number of returned results using LIMIT and OFFSET. Since I am not returning all results upon a query I need to include the number of hits in the result. somequery.count() somequery.limit(n).offset(m).all() The problem is that response

[sqlalchemy] modifying enable_seqscan option

2012-03-15 Thread Eduardo
Hi, Is it possible to set this option to off by using sqlalchemy? Thanks Ed -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/JGkEvUVvoncJ. To post to this group,

Re: [sqlalchemy] Returningquery results with the result number

2012-03-15 Thread Conor
On 03/15/2012 04:52 AM, Eduardo wrote: Hi, In order to avoid bottlenecks I am force to limit the number of returned results using LIMIT and OFFSET. Since I am not returning all results upon a query I need to include the number of hits in the result. somequery.count()

Re: [sqlalchemy] modifying enable_seqscan option

2012-03-15 Thread A.M.
On Mar 15, 2012, at 5:54 AM, Eduardo wrote: Hi, Is it possible to set this option to off by using sqlalchemy? Thanks Ed connection.execute(SET enable_seqscan TO off;) But if you use that in production, you're nuts. Cheers, M -- You received this message because you are subscribed to

[sqlalchemy] Re: Handle many to many relationship

2012-03-15 Thread zz elle
Hi, You can define a SA object associated to the table tarife_dossier: - you set its IdDossier (IdAt) attributes to its associated dossier (article) id - or you set dossier (article_tarife) to its associated dossier (articke) object and you save it ! PS: tarife ou tarif ? On Thursday,

[sqlalchemy] Re: Bidirectional, self-referential association table

2012-03-15 Thread zz elle
I transform it into declarative way and its seems to work but it's not bidirectional. To support bidirectional friendship(A, B friends) i would say that you might transform it into 2 unidirectional friendships (A friend of B and B friend of A). You could perhaps hide this complexity with an

Re: [sqlalchemy] referencing main query entity from EXISTS [any()] subquery

2012-03-15 Thread Michael Bayer
On Mar 15, 2012, at 7:40 PM, Gunnar Schaefer wrote: I don't quite know how to explain it right, but I guess I want to create a subquery that references the entity of the main query. in SQL we call this a correlated subquery. The subquery refers to a table in the enclosing query. Here

Re: [sqlalchemy] referencing main query entity from EXISTS [any()] subquery

2012-03-15 Thread Michael Bayer
On Mar 15, 2012, at 10:03 PM, Michael Bayer wrote: And here is my best attempt at doing the same thing in sqlalchemy: Job_A = aliased(Job) DBSession.query(Job_A).join(DataContainer).filter(~ DataContainer.jobs.any(Job.id Job_A.id)).all() any_query =

[sqlalchemy] PostgreSQL Multidimensional arrays in SQLAlchemy

2012-03-15 Thread Faheem Mitha
Hi, I posted http://stackoverflow.com/questions/9729175/multidimensional-arrays-in-sqlalchemy to StackOverflow. Reproduced below. Please CC me on any reply. Thanks. Regards, Faheem