[sqlalchemy] One database Metadata - multiple sessions?

2007-04-08 Thread Arun Kumar PG
Hi All, Can we initialize metadata one time (let's say during the first time application access) , store the same in the global context and then reuse the already intialized metatada for catering multiple requests ? Any threading related issues ? So here is what I want to do and wanna confirm if

[sqlalchemy] Re: One database Metadata - multiple sessions?

2007-04-08 Thread Michael Bayer
On Apr 8, 2007, at 5:54 AM, Arun Kumar PG wrote: Hi All, Can we initialize metadata one time (let's say during the first time application access) , store the same in the global context and then reuse the already intialized metatada for catering multiple requests ? Any threading

[sqlalchemy] Ordering by field in related object

2007-04-08 Thread Norjee
It seems I don't understand how i can order the results of a query. Assume that i have two object Story and StoryStats. Each Story has one StoryStats, mapped by ForeignKey. The relation is eagerloaded (lazy=False) (The actual model is a tad more complicated, but the idea is the same) When i now

[sqlalchemy] Re: Ordering by field in related object

2007-04-08 Thread Norjee
The generated query is = SELECT verhalen_verhaal.body AS verhalen_verhaal_body, verhalen_verhaal.update_date AS verhalen_verhaal_update_date, verhalen_verhaal.user_id AS verhalen_verhaal_user_id, verhalen_verhaal.review_date AS verhalen_verhaal_review_date,

[sqlalchemy] Re: Ordering by field in related object

2007-04-08 Thread Michael Bayer
eagerly loaded relationships are not part of the main Query criterion/ select. the eager loads are always tacked on secondary to the inner query. the main goal being that if you had lazy or eagerly loaded relationships, in both cases youd get the identical result. so any tables that

[sqlalchemy] Re: One database Metadata - multiple sessions?

2007-04-08 Thread Arun Kumar PG
Thx Michael! On 4/8/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 8, 2007, at 5:54 AM, Arun Kumar PG wrote: Hi All, Can we initialize metadata one time (let's say during the first time application access) , store the same in the global context and then reuse the already

[sqlalchemy] Re: Ordering by field in related object

2007-04-08 Thread Arun Kumar PG
Since I am new to SA just want if that means that even if we have an eager load on a 1:N relationships we should still do an explicit JOIN if the query involves columns from both side of relations? On 4/9/07, Michael Bayer [EMAIL PROTECTED] wrote: eagerly loaded relationships are not part of

[sqlalchemy] Session allocation and (non) thread safety

2007-04-08 Thread David Bolen
The Session object clearly isn't thread-safe, which is fine, but I was curious if the intention is for that to also include its initial allocation? That is, I'd like to potentially allocate a new Session object in thread A, but any and all operations on the object aside from the instantiation

[sqlalchemy] Re: Session allocation and (non) thread safety

2007-04-08 Thread Michael Bayer
On Apr 9, 2007, at 12:47 AM, David Bolen wrote: The Session object clearly isn't thread-safe, which is fine, but I was curious if the intention is for that to also include its initial allocation? That is, I'd like to potentially allocate a new Session object in thread A, but any and all