Re: [sqlalchemy] Extending mapper to use PostgreSQL's INSERT/UPDATE...RETURNING

2009-12-23 Thread Igor Katson
Michael Bayer wrote: On Dec 22, 2009, at 5:20 PM, Igor Katson wrote: 0.5 supports this using the postgres_returning argument to update() and insert(), but the ORM doesn't make use of it. in 0.6, the feature has been generalized using the returning() method on insert() and update

[sqlalchemy] Extending mapper to use PostgreSQL's INSERT/UPDATE...RETURNING

2009-12-22 Thread Igor Katson
(), but to be able to use INSERT/UPDATE...RETURNING, which will update the values based on the database data. As far as I see, there is no such functionality in the mapper or Session, and I want to extend it for personal use. Could you please guide me in the right direction, how to make that? Best regards, Igor

[sqlalchemy] Detach a Session from threadlocal behaviour

2009-12-22 Thread Igor Katson
connection) and continue using the existing one. Is there a way to accomplish this? Thanks in advance, Igor Katson. -- 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

Re: [sqlalchemy] Detach a Session from threadlocal behaviour

2009-12-22 Thread Igor Katson
Michael Bayer wrote: On Dec 22, 2009, at 3:03 PM, Igor Katson wrote: Hi, when a request comes into my webapp, pylons makes a shiny new threadlocal Session for this request (thread), and it's perfectly fine. However, after returning the result to the client, I want to be able

Re: [sqlalchemy] Extending mapper to use PostgreSQL's INSERT/UPDATE...RETURNING

2009-12-22 Thread Igor Katson
Michael Bayer wrote: On Dec 22, 2009, at 2:51 PM, Igor Katson wrote: I am concerned about the problem of the orm framework using SELECT's a lot, which can be not used in many cases, when dealing with Postgres after INSERTs or UPDATEs. When using postgresql, I want sqlalchemy, when

Re: [sqlalchemy] Expressing UPDATE...SET column = column + 1

2009-12-21 Thread Igor Katson
Alex Brasetvik wrote: On 12/20/09 13:31 , Igor Katson wrote: I want to increment a column by 1 with UPDATE table SET column = column + 1 WHERE id = %(id)s, This is covered here: http://www.sqlalchemy.org/docs/06/sqlexpression.html however, when writing instance.column += 1 in python

[sqlalchemy] Expressing UPDATE...SET column = column + 1

2009-12-20 Thread Igor Katson
is not correct, I changed the simple line in python to smth huge like this: update_statement = table.update(table.c.id == instance.id, {'column': text('column + 1')}) meta.Session.execute(update_statement) Is there a way to make it simpler? Regards, Igor Katson. -- You received this message

[sqlalchemy] Using database-level cascade when issuing Session.delete

2009-10-29 Thread Igor Katson
Hello! I am stuck when trying to delete an object, on which there are references. I have a database-level ON DELETE CASCADE rule, but when issuing Session.delete, it raises an IntegrityError, cause sqlalchemy first tries to SET NULL the references on all the children. If I use cascade='all,