[sqlalchemy] in_ SADeprecationWarning

2008-07-03 Thread Marin
I use the following code: query = meta.Session.query(db.Object) all_objects = [1,2,3] objects = query.filter(db.Object.ObjectID.in_(*all_objects)).all() And I get this error: SADeprecationWarning: passing in_ arguments as varargs is deprecated, in_ takes a single argument that is a sequence or a

[sqlalchemy] Re: in_ SADeprecationWarning

2008-07-03 Thread az
SA version? sql dialect? what's table definition? On Thursday 03 July 2008 14:43:44 Marin wrote: I use the following code: query = meta.Session.query(db.Object) all_objects = [1,2,3] objects = query.filter(db.Object.ObjectID.in_(*all_objects)).all() And I get this error:

[sqlalchemy] Re: in_ SADeprecationWarning

2008-07-03 Thread Marin
I got it... I wanted to replicate the error in a single file, but I couldn't have them booth. I realized then that the problem was in 2 different SA version installed on my computer. Now that i removed the older everything works correctly. On Jul 3, 1:48 pm, [EMAIL PROTECTED] wrote: SA version?

[sqlalchemy] Polymorphic association woes

2008-07-03 Thread Gaetan de Menten
Hi list, Could anybody tell me what's wrong with the following code? It's only the code in the poly_assoc example directory (the generic version) where I'm trying to set the polymorphic part of the relationship. It gets me the traceback below and I don't really understand why: Traceback (most

[sqlalchemy] Re: Polymorphic association woes

2008-07-03 Thread az
what that should do? An association to a polymorphic object that is not plain-class-hierarchy (which is, several associations, one per subtype)? i am asking as this seems as another way to do aspects/multiple inheritance; my way is a single association with multiple references (to the

[sqlalchemy] IDEA: Call-local vs thread-local context

2008-07-03 Thread Iwan
Hi there, I have an idea I'd like to bounce off people here. It relates to the problem described here: http://www.sqlalchemy.org/docs/05/session.html#unitofwork_contextual The solution used there makes the assumption that each request will happen in its own thread, and uses python's

[sqlalchemy] Re: IDEA: Call-local vs thread-local context

2008-07-03 Thread Michael Bayer
On Jul 3, 2008, at 5:05 AM, Iwan wrote: I was wondering if it is not possible to do something that is local to the current call-stack, instead of the current thread. I think there are two issues here: a) a general mechanism for remembering a call-local context b) using it to provide a

[sqlalchemy] Re: Polymorphic association woes

2008-07-03 Thread Michael Bayer
the first set of operations on the Session place every new object, including two Address objects and two GenericAssoc objects, in the session. Then the session is cleared. Then, a series of loads load in all those same objects, including the same Address objects and GenericAssoc

[sqlalchemy] Using domain object instead of Table as first argument of select function

2008-07-03 Thread [EMAIL PROTECTED]
Hi everybody, I am working on my graduate (final :)) exam, and SQLAlchemy is main topic. I was tryinig example from ORM tutorial: from sqlalchemy import select, func session.query(User).from_statement( ... select( ...[users_table], ...

[sqlalchemy] Re: Using domain object instead of Table as first argument of select function

2008-07-03 Thread Michael Bayer
On Jul 3, 2008, at 10:52 AM, [EMAIL PROTECTED] wrote: Is it some better way of doing this? keep reading the tutorial and then try sess.query(User).filter(User.name==select([func.max(User.name)])) --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: IDEA: Call-local vs thread-local context

2008-07-03 Thread az
it is possible to dig the stack to find the context u need... no worries about that, but u have to know the name of it, as there might be two contexts living in same scope (e.g.: copy data from DB1 to DB2), and u could get the wrong one -- python has no ordering in its

[sqlalchemy] Re: Polymorphic association woes

2008-07-03 Thread az
On Thursday 03 July 2008 17:15:40 Michael Bayer wrote: the first set of operations on the Session place every new object, including two Address objects and two GenericAssoc objects, in the session. Then the session is cleared. Then, a series of loads load in all those same objects,

[sqlalchemy] Re: Polymorphic association woes

2008-07-03 Thread Gaetan de Menten
On Thu, Jul 3, 2008 at 6:01 PM, [EMAIL PROTECTED] wrote: On Thursday 03 July 2008 17:15:40 Michael Bayer wrote: the first set of operations on the Session place every new object, including two Address objects and two GenericAssoc objects, in the session. Then the session is cleared. Then,

[sqlalchemy] Re: Polymorphic association woes

2008-07-03 Thread az
so my woe about this thing which i asked in the aspects-revisited mail: can i get all someaddress.members in ONE query? some secondary mapper - but how? polymorphic-union? On Thursday 03 July 2008 19:36:12 Gaetan de Menten wrote: On Thu, Jul 3, 2008 at 6:01 PM, [EMAIL PROTECTED] wrote: On

[sqlalchemy] Re: Polymorphic association woes

2008-07-03 Thread az
also, can someone explain what is the difference (sql-plan-wise) in the approaches? this one is: address - addressable - users - orders my one is otherway around: address - addressable - users - orders both declare multiple (per-type)

[sqlalchemy] Re: Polymorphic association woes

2008-07-03 Thread az
seems this way many users can have same adress, but one user (or order) cannot have more than one adress. so it's a polymorphic 1-to-many. my one is for a many to many. correct? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] Re: transactions with multiple potential constraint violations

2008-07-03 Thread Michael Bayer
On Jul 3, 2008, at 1:09 PM, Simon wrote: Hi all, I have a transactional session which save()s multiple objects to multiple tables where each object potentially violates a unique primary key or just a unique key constraint. At flush() time, MySQL returns an IntegrityError which specifies

[sqlalchemy] Re: Polymorphic association woes

2008-07-03 Thread az
in this example, if u make another user u2 pointing to same address1, u1.adresses goes wrong... - last one wins. On Thursday 03 July 2008 19:36:12 Gaetan de Menten wrote: On Thu, Jul 3, 2008 at 6:01 PM, [EMAIL PROTECTED] wrote: On Thursday 03 July 2008 17:15:40 Michael Bayer wrote: the

[sqlalchemy] Re: sharding id_chooser query_chooser

2008-07-03 Thread lilo
For example, you have user, post, comment table. Sharding is done by user_id and shard_lookup is done via lookup table. If one is going to create a post, you would lookup the user_id in the lookup table and insert the post entry into the shard where the user_id belongs to. How would you