[sqlalchemy] Dogpile.cache w/ SQLAlchemy

2012-09-24 Thread David McKeone
As per this comment: http://techspot.zzzeek.org/2012/04/19/using-beaker-for-caching-why-you-ll-want-to-switch-to-dogpile.cache/#comment-503780670 Has any work been put into an example for using Dogpile.cache with SQLAlchemy? I'm about to embark on implementing caching and I don't want to

Re: [sqlalchemy] Dogpile.cache w/ SQLAlchemy

2012-09-24 Thread Michael Bayer
yes, the example in 0.8 should be changed to this, but I haven't done it yet. dogpile's usage is similar to Beaker as far as the general calling pattern. A tutorial format of the example using dogpile is attached. On Sep 24, 2012, at 7:15 AM, David McKeone wrote: As per this comment:

Re: [sqlalchemy] Dogpile.cache w/ SQLAlchemy

2012-09-24 Thread David McKeone
Great, thanks Mike! On Monday, September 24, 2012 4:15:29 PM UTC+2, Michael Bayer wrote: yes, the example in 0.8 should be changed to this, but I haven't done it yet. dogpile's usage is similar to Beaker as far as the general calling pattern. A tutorial format of the example using

[sqlalchemy] drop index bug?

2012-09-24 Thread Bruno Binet
Hi, Using postgres schemas, I am unable to drop an index that have just been created. The following example will produce a sqlalchemy.exc.ProgrammingError: (ProgrammingError) index my_idx does not exist: from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Index

[sqlalchemy] Looking up the class of a backref

2012-09-24 Thread John Anderson
If I have a DB structure similar to this: class Parent(Base): pass class Child(Base): parent = relation(Parent, backref='children') and I have an instanced of Parent and want to figure out what the class of instance.children is, how would I do that? -- You received this message

Re: [sqlalchemy] Looking up the class of a backref

2012-09-24 Thread Michael Bayer
On Sep 24, 2012, at 11:16 AM, John Anderson wrote: If I have a DB structure similar to this: class Parent(Base): pass class Child(Base): parent = relation(Parent, backref='children') and I have an instanced of Parent and want to figure out what the class of instance.children

[sqlalchemy] [Q] Option joinedload_all with joined table inheritance

2012-09-24 Thread Ladislav Lenart
Hello. Suppose the following example query q = session.query(A) q = q.options(joinedload_all(A.b, B.c, C.d) q = q.otions(joinedload_all(A.client, PersonalClient.person) return q where A has b_id FK to b(id) client_id FK to client(id) B has c_id

Re: [sqlalchemy] [Q] Option joinedload_all with joined table inheritance

2012-09-24 Thread Ladislav Lenart
Hello. On 24.9.2012 18:31, Michael Bayer wrote: On Sep 24, 2012, at 12:06 PM, Ladislav Lenart wrote: Hello. Suppose the following example query q = session.query(A) q = q.options(joinedload_all(A.b, B.c, C.d) q = q.otions(joinedload_all(A.client, PersonalClient.person)

Re: [sqlalchemy] [Q] Option joinedload_all with joined table inheritance

2012-09-24 Thread Ladislav Lenart
Hello. I have tried the variant for SA 0.7. The query I tried is this: q = self.session.query(self.ClientProduct) q = q.options(joinedload_all(A.b, B.c)) #q = q.options(joinedload_all( #A.client.of_type(PersonalClient), #PersonalClient.person) #) q =

Re: [sqlalchemy] [Q] Option joinedload_all with joined table inheritance

2012-09-24 Thread Michael Bayer
On Sep 24, 2012, at 1:14 PM, Ladislav Lenart wrote: Hello. I have tried the variant for SA 0.7. The query I tried is this: q = self.session.query(self.ClientProduct) q = q.options(joinedload_all(A.b, B.c)) #q = q.options(joinedload_all( #

[sqlalchemy] Soft Delete Pattern in SQLAlchemy

2012-09-24 Thread Mahmoud Abdelkader
I wanted to know some views about the soft-delete (anti?) pattern and whether or not I'm going about it the right way in my code base. We have a piece of code: class NoDeletedQuery(Query): def __new__(cls, *args, **kwargs): if args and hasattr(args[0][0], deleted_at):

Re: [sqlalchemy] drop index bug?

2012-09-24 Thread Bruno Binet
Thanks! On 24 September 2012 17:19, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 24, 2012, at 10:24 AM, Bruno Binet wrote: Should I report this as a bug somewhere? its a bug, ticket 2571 is created and fixed, http://www.sqlalchemy.org/trac/ticket/2571 you can download 0.7.9 tip

Re: [sqlalchemy] Soft Delete Pattern in SQLAlchemy

2012-09-24 Thread Mahmoud Abdelkader
I ended up going with your recipe and this is my final result: class NoDeletedQuery(Query): Subclass query and provide a pre-fabricated WHERE clause that is applied to all queries. It uses the enable_assertions() method available in SA v0.5.6 and above to bypass the Query