[sqlalchemy] Re: Subquery questions

2009-11-10 Thread Mike Conley
On Tue, Nov 10, 2009 at 9:55 PM, jcm wrote: > > Folks, > > I could do with some decent docs on subqueries. I've tried to play > with what's on the website, but it's not helping me to convert the > following into an SQLAlchemy subquery: > > select * from symbollistentries WHERE > symbollistentries

[sqlalchemy] Re: what time sqlalchemy 0.6 out?

2009-11-10 Thread Michael Bayer
haven't seen a DBAPI for drizzle as of yet. On Nov 10, 2009, at 10:35 PM, 诚子 wrote: > the sqlalchemy 0.6 will support drizzle database? > > 2009/11/10 Michael Bayer > we are looking at feburary at the latest, hopefully. > > > On Nov 9, 2009, at 5:14 AM, 诚子 wrote: > >> RT, >> i'm using it no

[sqlalchemy] Re: what time sqlalchemy 0.6 out?

2009-11-10 Thread 诚子
the sqlalchemy 0.6 will support drizzle database? 2009/11/10 Michael Bayer > we are looking at feburary at the latest, hopefully. > > > On Nov 9, 2009, at 5:14 AM, 诚子 wrote: > > RT, > i'm using it now, > i want it's out when > i product is online. > > -- > my.unix-center.net/~WeiZhicheng

[sqlalchemy] Subquery questions

2009-11-10 Thread jcm
Folks, I could do with some decent docs on subqueries. I've tried to play with what's on the website, but it's not helping me to convert the following into an SQLAlchemy subquery: select * from symbollistentries WHERE symbollistentries.symbollistentry_id NOT IN (select symbollistentries.symbolli

[sqlalchemy] Re: Server / Client-gtk app

2009-11-10 Thread Michael Bayer
On Nov 9, 2009, at 8:42 PM, Francesco Meloni wrote: > > > 2009/11/10 Michael Bayer > > > On Nov 8, 2009, at 5:06 PM, M3nt0r3 wrote: > > > > > Hi , i am sorry for my english, i am trying ti make a Server/Client > > app. Until now client-gtk mapped the db and spoked directly with the > > db

[sqlalchemy] Re: Adding arbitrary attribute to a model instance during querying

2009-11-10 Thread Michael Bayer
On Nov 10, 2009, at 4:24 PM, hb wrote: > > Hi all, > > I have two models: User and Project. The relationship is one-to-many. > What I want to achieve is querying users and the number of projects > they are connected to. I also want to order the users according to the > project counts. > > The

[sqlalchemy] Mystic with inheritance

2009-11-10 Thread Lo Pata
Hi! I have base class (Bas) and derived one (Der). First is mapped. I wanted second to use the same mapping but got exception: AttributeError: 'NoneType' object has no attribute 'set' . But if i add Bas class init before Der class init no exception is raised! Code ###

[sqlalchemy] Re: Can't append "WHERE col IN" to select object

2009-11-10 Thread Michael Bayer
Bryan wrote: > > Why can't I refer to a column with query.c at this point? The query > already has columns in its c collection, and I don't want to have > repeat string names of columns, it would be cleaner to say > query.c.jobId than "jobId". I thought that query.c.jobId would simply > generate

[sqlalchemy] Adding arbitrary attribute to a model instance during querying

2009-11-10 Thread hb
Hi all, I have two models: User and Project. The relationship is one-to-many. What I want to achieve is querying users and the number of projects they are connected to. I also want to order the users according to the project counts. The following code seems to work, but the result is a list of (

[sqlalchemy] Re: Can't append "WHERE col IN" to select object

2009-11-10 Thread Bryan
On Nov 10, 12:46 pm, "Michael Bayer" wrote: > Bryan wrote: > > > Trying to append this to a select object: > > "WHERE jobId IN (SELECT id FROM job WHERE number=1)" > > > So I do this: > > query = select() > > subq = select([job.c.id], job.c.number==1).as_scalar() > > query = query.where

[sqlalchemy] Re: Can't append "WHERE col IN" to select object

2009-11-10 Thread Michael Bayer
Bryan wrote: > > Trying to append this to a select object: > "WHERE jobId IN (SELECT id FROM job WHERE number=1)" > > So I do this: > query = select() > subq = select([job.c.id], job.c.number==1).as_scalar() > query = query.where(query.c.jobId.in_(subq)) > > But that is not working: "Every

[sqlalchemy] Can't append "WHERE col IN" to select object

2009-11-10 Thread Bryan
Trying to append this to a select object: "WHERE jobId IN (SELECT id FROM job WHERE number=1)" So I do this: query = select() subq = select([job.c.id], job.c.number==1).as_scalar() query = query.where(query.c.jobId.in_(subq)) But that is not working: "Every derived table must have its ow

[sqlalchemy] Re: Query caching and garbage collection of related instances

2009-11-10 Thread Michael Bayer
Adam Dziendziel wrote: > > By the way, is this possible to tell SQLAlchemy to load two lazy > attributes together, using a single query i.e. like it does with > eagerly-loaded attributes, but on demand? > If collection1 and some_reference points to different rows in the > database, the code: > s

[sqlalchemy] Re: Query caching and garbage collection of related instances

2009-11-10 Thread Adam Dziendziel
On 8 Lis, 20:29, Michael Bayer wrote: > On Nov 7, 2009, at 6:03 PM, Adam Dziendziel wrote: > > What I usually do when i want to ensure what gets cached (since im   > usually serializing into memcached), and i dont want to worry what the   > particular eager loading configuration is, is to make a

[sqlalchemy] Re: Query caching and garbage collection of related instances

2009-11-10 Thread Adam Dziendziel
On 8 Lis, 20:32, Michael Bayer wrote: > On Nov 8, 2009, at 6:21 AM, Adam Dziendziel wrote: > > that behavior occurs if "theme" has been expired.   this is   > "expire_on_commit" which you should probably disable, since the fact   > that you are "caching" the objects means you aren't concerned abo