Re: [sqlalchemy] how to use version_id_col

2011-01-18 Thread Jan Mueller
On 01/18/2011 02:08 AM, Michael Bayer wrote: On Jan 17, 2011, at 5:42 PM, Jan Mueller wrote: try: obj = Session.query(MyObject).filter(MyObject.updated_at == my_hidden_updated_at).filter(MyObject.id == id).one() except orm.exc.NoResultFound: pr

Re: [sqlalchemy] how to use version_id_col

2011-01-17 Thread Michael Bayer
On Jan 17, 2011, at 5:42 PM, Jan Mueller wrote: >> try: >> obj = Session.query(MyObject).filter(MyObject.updated_at == >> my_hidden_updated_at).filter(MyObject.id == id).one() >> except orm.exc.NoResultFound: >> print "stale version !" >> >> for

Re: [sqlalchemy] how to use version_id_col

2011-01-17 Thread Jan Mueller
On 01/17/2011 05:14 PM, Michael Bayer wrote: On Jan 16, 2011, at 8:15 PM, Jan Mueller wrote: Ok then i will try to explain it: I have a pylons web application... and i want to use the entity attribute updated_at as a Datetime version_id... so i modified the entity with the mapper args and put

Re: [sqlalchemy] how to use version_id_col

2011-01-17 Thread Michael Bayer
On Jan 17, 2011, at 11:14 AM, Michael Bayer wrote: > > > However, interesting here is that you're merging, and I wonder if merge() > should be also checking version_id col for a stale version - that might be > the correct way for SQLA to behave in this case. I'm going to check what > Hibern

Re: [sqlalchemy] how to use version_id_col

2011-01-17 Thread Michael Bayer
On Jan 16, 2011, at 8:15 PM, Jan Mueller wrote: > Ok then i will try to explain it: > > I have a pylons web application... and i want to use the entity attribute > updated_at as a Datetime version_id... > so i modified the entity with the mapper args and put a hidden input field in > my edit h

Re: [sqlalchemy] how to use version_id_col

2011-01-16 Thread Jan Mueller
Ok then i will try to explain it: I have a pylons web application... and i want to use the entity attribute updated_at as a Datetime version_id... so i modified the entity with the mapper args and put a hidden input field in my edit html forms for the updated_at value... in order to preserve i

Re: [sqlalchemy] how to use version_id_col

2011-01-16 Thread Michael Bayer
if there's a bug in version_id_col I'd really like to know. I don't understand the use case for setting the column explicitly, then having it not persist. On Jan 16, 2011, at 7:11 PM, Jan Mueller wrote: > I switched to 0.6.3 and version_id_col works... just like i expected... > that's re

Re: [sqlalchemy] how to use version_id_col

2011-01-16 Thread Jan Mueller
I switched to 0.6.3 and version_id_col works... just like i expected... that's really odd... i guess i will stay at this version and everything will be fine ;-) thank you very much. and sorry for the lacky explanation of my problem. Greetings Jan -- You received this message because you are s

Re: [sqlalchemy] how to use version_id_col

2011-01-16 Thread Michael Bayer
On Jan 16, 2011, at 1:20 PM, Jan Mueller wrote: > Hi everybody, > > help... > > i need optimistic locking for some concurrently edited entities. > I am experiencing some problems with the "version_id_col" feature. I wanted > to use it with my pylons application, but it does not work at all. >

[sqlalchemy] how to use version_id_col

2011-01-16 Thread Jan Mueller
Hi everybody, help... i need optimistic locking for some concurrently edited entities. I am experiencing some problems with the "version_id_col" feature. I wanted to use it with my pylons application, but it does not work at all. I use sqlalchemy 0.6.4 with sqlite (for developement purposes). M