Re: [sqlalchemy] Re: find the table columns

2010-01-21 Thread laurent FRANCOIS
On Thu, 2010-01-14 at 05:29 -0800, Kosu wrote: try this: user.__table__.c.keys() should work Kos Rafal AttributeError: 'User' object has no attribute '__table__' thanks anyway On 14 Sty, 11:39, laurent FRANCOIS lau.franc...@worldonline.fr wrote: Hello everybody Let's say

[sqlalchemy] Configuring an existing session

2010-01-21 Thread Tarek Ziadé
Hi, I use a global session instance to work with my DB, so all module import it and use it. But at some point I sometimes need to reconfigure the engine to use another DB. I want to reconfigure the existing instance so other modules can still use the same session object to work with the DB. can

[sqlalchemy] sqlsoup and partitioned db's

2010-01-21 Thread razamatan
sqlsoup explicitly used a scoped session, but i would like to use a shardedsession for my horizontally partitioned db. is this supported at all? thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

Re: [sqlalchemy] Re: find the table columns

2010-01-21 Thread Tamás Bajusz
On Thu, Jan 21, 2010 at 9:08 AM, laurent FRANCOIS lau.franc...@worldonline.fr wrote: On Thu, 2010-01-14 at 05:29 -0800, Kosu wrote: try this: user.__table__.c.keys() should work Kos Rafal AttributeError: 'User' object has no attribute '__table__' from sqlalchemy import * metadata =

Re: [sqlalchemy] Configuring an existing session

2010-01-21 Thread Michael Bayer
Tarek Ziadé wrote: Hi, I use a global session instance to work with my DB, so all module import it and use it. But at some point I sometimes need to reconfigure the engine to use another DB. I want to reconfigure the existing instance so other modules can still use the same session object

Re: [sqlalchemy] sqlsoup and partitioned db's

2010-01-21 Thread Michael Bayer
razamatan wrote: sqlsoup explicitly used a scoped session, but i would like to use a shardedsession for my horizontally partitioned db. is this supported at all? thanks. sure in 0.5 just swap out the Session global in sqlsoup. in 0.6 you can set a session on a per-SqlSoup basis:

[sqlalchemy] LIMIT function behavior

2010-01-21 Thread Kent
The limit() function behaves in a way that is possibly unexpected: If you ask sqlalchemy to query limit(3) where a join is involved, for example, and 2 of the top-3 are actually the same primary key, sqlalchemy gets the 3 results, throws out the duplicate and your query size ends up as 2. This

Re: [sqlalchemy] LIMIT function behavior

2010-01-21 Thread Michael Bayer
Kent wrote: The limit() function behaves in a way that is possibly unexpected: If you ask sqlalchemy to query limit(3) where a join is involved, for example, and 2 of the top-3 are actually the same primary key, sqlalchemy gets the 3 results, throws out the duplicate and your query size ends

[sqlalchemy] Re: LIMIT function behavior

2010-01-21 Thread Kent
Unfortunately, in the case I noticed this happen, the join needs to be applied first since the filter's where clause and the order by both depend on the joined tables. Don't think your solution is helpful in that case, but informative nonetheless. I can imagine a DISTINCT helping (I am using

Re: [sqlalchemy] Re: LIMIT function behavior

2010-01-21 Thread Michael Bayer
Kent wrote: Unfortunately, in the case I noticed this happen, the join needs to be applied first since the filter's where clause and the order by both depend on the joined tables. Don't think your solution is helpful in that case, but informative nonetheless. I can imagine a DISTINCT