Re: [sqlalchemy] Belonging to a session vs being in the session

2014-07-25 Thread George Sakkis
On Thursday, 24 July 2014 21:56:11 UTC+3, Michael Bayer wrote: expunge() is a bug: https://bitbucket.org/zzzeek/sqlalchemy/issue/3139/expunge-after-delete-fails it’s supposed to raise (hence can’t fix this til 1.0). so ignore expunge. if you were to emit session.rollback(), you’d find

Re: [sqlalchemy] Belonging to a session vs being in the session

2014-07-25 Thread Michael Bayer
On Jul 25, 2014, at 4:43 AM, George Sakkis george.sak...@gmail.com wrote: On Thursday, 24 July 2014 21:56:11 UTC+3, Michael Bayer wrote: expunge() is a bug: https://bitbucket.org/zzzeek/sqlalchemy/issue/3139/expunge-after-delete-fails it's supposed to raise (hence can't fix this

[sqlalchemy] Re: Multiple tables and foreignkey constraints

2014-07-25 Thread Ken Roberts
This is probably violating some normal form, but after playing with it (Thanks Michael and Jonathan), this seems to work for what I'm using. Suggestions welcome on improving it. #!/usr/bin/env python from sqlalchemy import Column, ForeignKey, Integer, MetaData, Sequence, String, \

[sqlalchemy] Re: Multiple tables and foreignkey constraints

2014-07-25 Thread Ken Roberts
Thanks for the help Jonathan and Michael. The below seems to work for what I'm doing. Let me know what normal forms I'm violating with it :) from sqlalchemy import Column, ForeignKey, Integer, MetaData, Sequence, String, \ create_engine from sqlalchemy.orm import backref,

[sqlalchemy] Dangers of setting a session's expire_on_commit=False?

2014-07-25 Thread Paul Molodowitch
Hi all - so I'm thinking of disabling the expire_on_commit property for my default sessionmaker object, and I was wondering what the potential issues with this were. Is it simply that the next access of the data on it could be using out-of-date information? Don't objects potentially have this

Re: [sqlalchemy] Dangers of setting a session's expire_on_commit=False?

2014-07-25 Thread Michael Bayer
On Jul 25, 2014, at 6:22 PM, Paul Molodowitch elron...@gmail.com wrote: Hi all - so I'm thinking of disabling the expire_on_commit property for my default sessionmaker object, and I was wondering what the potential issues with this were. Is it simply that the next access of the data on it

Re: [sqlalchemy] Dangers of setting a session's expire_on_commit=False?

2014-07-25 Thread Claudio Freire
On Fri, Jul 25, 2014 at 7:55 PM, Michael Bayer mike...@zzzcomputing.com wrote: Don't objects potentially have this problem anyway, in the sense that if they are accessed TWICE after a commit, the second access will use the data cached from the first, and could again be out of date? only if

[sqlalchemy] Strange error after SQLAlchemy update: 'list' object has no attribute '_all_columns'

2014-07-25 Thread ThiefMaster
Nicely formatted version: http://stackoverflow.com/questions/24930155/strange-error-after-sqlalchemy-update-list-object-has-no-attribute-all-colu After updating to the most recent SQLAlchemy one of my slightly more complex query started to fail with an error inside SQLalchemy. Here's a

[sqlalchemy] table.update() and CTE

2014-07-25 Thread Jon Nelson
I seem to be having some trouble generating an update statement like this: with baz AS ( select name, coalesce( exists ( select 1 from bar where bar.name=foo.name ), False) AS found_name from foo ), update FOO SET found_name = baz.found_name FROM

Re: [sqlalchemy] Dangers of setting a session's expire_on_commit=False?

2014-07-25 Thread Michael Bayer
On Jul 25, 2014, at 7:16 PM, Claudio Freire klaussfre...@gmail.com wrote: On Fri, Jul 25, 2014 at 7:55 PM, Michael Bayer mike...@zzzcomputing.com wrote: Don't objects potentially have this problem anyway, in the sense that if they are accessed TWICE after a commit, the second access will

Re: [sqlalchemy] Dangers of setting a session's expire_on_commit=False?

2014-07-25 Thread Claudio Freire
On Fri, Jul 25, 2014 at 10:09 PM, Michael Bayer mike...@zzzcomputing.com wrote: For the record, I'm using expire_on_commit=off, because I also use model instances outside the scope of their originating transaction. I've had no problems with it, but I did have to be very careful with the