[sqlalchemy] Re: DeclarativeBase and multiple inheritance

2009-12-14 Thread Daishy
Hi, I think you are right, messing with the metaclass for 4 columns is not really what i want :) Instead i will use your approach. Put those Columns in the function within the mixin along with all other functions and then call them within the column-definition. Thanks for fast answer! Greetings,

[sqlalchemy] Querying for empty / non-empty collection (in many-to-many relation)

2009-12-14 Thread Marcin Krol
Hello, rsvs = session.query(Reservation).filter(Reservation.email == em).filter(Reservation.newhosts == [] ).options(eagerload('newhosts')).all() sqlalchemy.exc.InvalidRequestError: Can't compare a collection to an object or collection; use contains() to test for membership. Well I can

Re: [sqlalchemy] Querying for empty / non-empty collection (in many-to-many relation)

2009-12-14 Thread Michael Bayer
Marcin Krol wrote: Hello, rsvs = session.query(Reservation).filter(Reservation.email == em).filter(Reservation.newhosts == [] ).options(eagerload('newhosts')).all() sqlalchemy.exc.InvalidRequestError: Can't compare a collection to an object or collection; use contains() to test for

Re: [sqlalchemy] Querying for empty / non-empty collection (in many-to-many relation)

2009-12-14 Thread Conor
Marcin Krol wrote: Hello, rsvs = session.query(Reservation).filter(Reservation.email == em).filter(Reservation.newhosts == [] ).options(eagerload('newhosts')).all() sqlalchemy.exc.InvalidRequestError: Can't compare a collection to an object or collection; use contains() to test for

[sqlalchemy] Delete on polymorphic child object causes KeyError in mapper.py (line 1461)

2009-12-14 Thread boothead
Hi, I have a parent/superclass object in a polymorphic relationship which is mapped against a select. The select is a table and a coalesce function (the coalesce is to make up for the fact that the polymorphic_on column doesn't exist). All seems to be working fine on update, create etc but

Re: [sqlalchemy] Delete on polymorphic child object causes KeyError in mapper.py (line 1461)

2009-12-14 Thread Michael Bayer
boothead wrote: Hi, I have a parent/superclass object in a polymorphic relationship which is mapped against a select. The select is a table and a coalesce function (the coalesce is to make up for the fact that the polymorphic_on column doesn't exist). All seems to be working fine on

[sqlalchemy] 0.6 - unexpected keyword argument 'transactional'

2009-12-14 Thread mando
Hi! I'm trying to pass from sqlalchemy 0.5 to 0.6, but I found some trouble. This code, that run correctly with 0.5: def query(self, n): class_name = n #engine = self.connection() Session = sessionmaker(bind=self.engine, autoflush=True,

Re: [sqlalchemy] 0.6 - unexpected keyword argument 'transactional'

2009-12-14 Thread Michael Bayer
mando wrote: Hi! I'm trying to pass from sqlalchemy 0.5 to 0.6, but I found some trouble. This code, that run correctly with 0.5: def query(self, n): class_name = n #engine = self.connection() Session = sessionmaker(bind=self.engine,

Re: [sqlalchemy] Re: Delete on polymorphic child object causes KeyError in mapper.py (line 1461)

2009-12-14 Thread Michael Bayer
boothead wrote: I'm on version 0.5.3, I will try it on 0.5.6 tomorrow. The check for column present above could be the problem... The column that I'm adding in the select is a func.coalesce(...).label ('something') and the my_super_table select that I'm mapping to is aliased... Would that

[sqlalchemy] Cache Invalidation. Alternatives to MapperExtension?

2009-12-14 Thread zende
I wrote a simple layer on top of my models that allows them to be easily inserted into and fetched from memcache. Now, I'm trying to solve the easier part :) -- cache invalidation. I can use mapper extensions, but I'm looking for a cleaner way. The biggest problem with MapperExtension is that

Re: [sqlalchemy] Cache Invalidation. Alternatives to MapperExtension?

2009-12-14 Thread Michael Bayer
zende wrote: I wrote a simple layer on top of my models that allows them to be easily inserted into and fetched from memcache. Now, I'm trying to solve the easier part :) -- cache invalidation. I can use mapper extensions, but I'm looking for a cleaner way. The biggest problem with

[sqlalchemy] Re: how to make a transaction fail for testing?

2009-12-14 Thread iain duncan
thanks Alex. I guess for integration tests one could also monkey patch it to override the commit method? thanks iain On Dec 13, 2:47 pm, Alex Brasetvik a...@brasetvik.com wrote: On Dec 13, 2009, at 22:25 , iain duncan wrote: Hey folks, I'm wondering how I can make a transaction fail

[sqlalchemy] Re: Cache Invalidation. Alternatives to MapperExtension?

2009-12-14 Thread zende
I used SesionExtension.after_flush. Worked great. Thanks for the help Michael! -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

Re: [sqlalchemy] Re: Cache Invalidation. Alternatives to MapperExtension?

2009-12-14 Thread Michael Bayer
zende wrote: I used SesionExtension.after_flush. Worked great. Thanks for the help Michael! if you are using transactions with isolation, the changes within the transaction wouldn't be visible to other connections until commit, which implies after_commit() might be the better target - though

[sqlalchemy] Function based index

2009-12-14 Thread akm
Hi All, I would like to create an index like this: CREATE UNIQUE INDEX index_name ON tbl_name ( UPPER(col1), col2); Is there a way to do that using the Index() ? Thanks, -- Abdul Kader -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To

Re: [sqlalchemy] Function based index

2009-12-14 Thread Michael Bayer
On Dec 14, 2009, at 8:43 PM, akm wrote: Hi All, I would like to create an index like this: CREATE UNIQUE INDEX index_name ON tbl_name ( UPPER(col1), col2); Is there a way to do that using the Index() ? thats ticket #695 which ive moved into the 0.6.xx milestone, where I thought