[sqlalchemy] query.filter AND ( ... OR ... OR ) how to?

2013-01-23 Thread Jose Soares
Hi all, I'm trying to compile a query to avoid Oracle limit of 1000 in IN(): def chunks(l, n): Yield successive n-sized chunks from l. for i in xrange(0, len(l), n): yield l[i:i+n] qry=session.query(Azienda).fiter(Azienda.c.cap=='') val=[1,3,3,4,3,23,2,4,5,6,7,8,9,90,34,2]

[sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Pau Tallada
Hi! I have a tree structure modeled into a database using adjacency-list paradigm (so having a reference to the parent). class Node(Base): id= Column(Integer, primary_key=True) name = Column(String(120)) parent_id = Column(Integer, ForeignKey('id')) I'm adding some custom

Re: [sqlalchemy] query.filter AND ( ... OR ... OR ) how to?

2013-01-23 Thread Simon King
On Wed, Jan 23, 2013 at 11:30 AM, Jose Soares jose.soa...@sferacarta.com wrote: Hi all, I'm trying to compile a query to avoid Oracle limit of 1000 in IN(): def chunks(l, n): Yield successive n-sized chunks from l. for i in xrange(0, len(l), n): yield l[i:i+n]

Re: [sqlalchemy] Couple of questions about filtering...

2013-01-23 Thread Werner
On 23/01/2013 07:47, Alexey Vihorev wrote: Ok, I've set up a complete test case: http://pastebin.com/W08w6Hg6 That throws an exception: TypeError: getattr(): attribute name must be string File h:\devProjectsT\aaTests\aaMisc\AlexeyVihorev\sahybrid-org.py, line 67, in module res =

Re: [sqlalchemy] query.filter AND ( ... OR ... OR ) how to?

2013-01-23 Thread Jose Soares
It works, thanks Simon. j On 01/23/2013 12:53 PM, Simon King wrote: On Wed, Jan 23, 2013 at 11:30 AM, Jose Soares jose.soa...@sferacarta.com wrote: Hi all, I'm trying to compile a query to avoid Oracle limit of 1000 in IN(): def chunks(l, n): Yield successive n-sized chunks from l.

RE: [sqlalchemy] Couple of questions about filtering...

2013-01-23 Thread Alexey Vihorev
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Werner Sent: Wednesday, January 23, 2013 2:00 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Couple of questions about filtering... On 23/01/2013 07:47, Alexey Vihorev

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Michael Bayer
On Jan 23, 2013, at 6:49 AM, Pau Tallada wrote: One final comment. With the contains_eager query, the instances that are part of the collection are retrieved from the database but not stored on the identity_map. Is that also the expected behaviour, isn't it? I need to read your whole

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Pau Tallada
Ok, thank you very much :D I'll keep poking, and i'll try to provide a sample code :P 2013/1/23 Michael Bayer mike...@zzzcomputing.com On Jan 23, 2013, at 6:49 AM, Pau Tallada wrote: One final comment. With the contains_eager query, the instances that are part of the collection are

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Pau Tallada
Hi, I have prepared a sample of code to ilustrate this behaviour :) Summarizing: session.expunge_all() n2 = session.query(Node).filter_by(name='n2').options(joinedload('ancestors')).one() print n2.ancestors AND: session.expunge_all() n2 = session.query(Node).filter_by(name='n2').one() n2 =

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Michael Bayer
On Jan 23, 2013, at 4:28 PM, Pau Tallada wrote: Hi, I have prepared a sample of code to ilustrate this behaviour :) Summarizing: session.expunge_all() n2 = session.query(Node).filter_by(name='n2').options(joinedload('ancestors')).one() print n2.ancestors AND:

Re: [sqlalchemy] mysqlconnector Problem

2013-01-23 Thread Jürg Hofmann
I installed version 0.8.0b2 from tar-file and the mysqlconnector is now working. Many thanks! Am Dienstag, 22. Januar 2013 11:37:42 UTC+1 schrieb Jürg Hofmann: Thanks, in wheezy is only 0.7.8, so i will try to install 0.7.9 from sid or 0.8 from sqlalchemy. Am Montag, 21. Januar 2013