[sqlalchemy] assert: "Failed to add object to the flush context!"

2017-01-24 Thread John Silver
I'm hitting this assert on line 2203 of orm/session.py. I used to hit an error about over 100 subsequent flushes at the same spot. Since updating my SQLAlchemy version yesterday I'm now hitting this instead. Can anyone with better knowledge of the ORM help me figure out what is happening? * I

[sqlalchemy] Validators not called for unhashable items when replacing the collection

2017-01-24 Thread Pedro Werneck
I have a relationship with a validator to automatically convert dicts appended to the collection, so I can do something like this: my_obj.my_collection.append({"rel_type_id": x}) Instead of this: my_obj.my_collection.append(RelType(rel_type_id=x)) That works exactly as expected, but when I tr

Re: [sqlalchemy] Bulk Operations with Joined Table Inheritance

2017-01-24 Thread Robert Sami
Thanks for the response Mike, I agree that using Core is pretty clean. One approach I considered was the following: ``` res = conn.execute(FooBase.__table__.insert(returning=[FooBase.id], values=[{} for i in range(10)])) conn.execute(FooDerived.__table__.insert(values=[{'id': _id, data: 'what

Re: [sqlalchemy] SqlAlchemy memory usage

2017-01-24 Thread 'Nikunj Yadav' via sqlalchemy
Thank you guys for your response. Upgrading to sqlalchemy >1.0 fixed it On Tuesday, January 17, 2017 at 11:16:39 AM UTC-8, Nikunj Yadav wrote: > > Hey Mike, > Thanks for the detailed response. I will try looking at my queries and > post back soon. Also thanks for the heads up on sqlalchemy up

Re: [sqlalchemy] Bulk Operations with Joined Table Inheritance

2017-01-24 Thread mike bayer
On 01/24/2017 04:49 PM, Robert Sami wrote: Hi SQLAlchemy wizards. I was interested in using the new bulk operations API (http://docs.sqlalchemy.org/en/latest/orm/persistence_techniques.html#bulk-operations) but was looking for some advice based on my use case. I have a class “FooDerived” whic

Re: [sqlalchemy] is it possible to upgrade an existing session to two-phase?

2017-01-24 Thread mike bayer
On 01/21/2017 05:05 PM, Jonathan Vanasco wrote: a given application makes explicit use of `commit` and `rollback` on the sqlalchemy session. a few views require interaction with some other technologies via a two-phase commit. under the current design, i can't enable two-phase commits for ever

[sqlalchemy] Bulk Operations with Joined Table Inheritance

2017-01-24 Thread Robert Sami
Hi SQLAlchemy wizards. I was interested in using the new bulk operations API (http://docs.sqlalchemy.org/en/latest/orm/persistence_techniques.html#bulk-operations) but was looking for some advice based on my use case. I have a class “FooDerived” which corresponds to a table that is linked to