Re: [sqlalchemy] Remove all objects of specified type from session

2019-01-29 Thread Mike Bayer
On Tue, Jan 29, 2019 at 2:52 PM Daniel Leon wrote: > > There is the method expunge which removes specified object from session and > expunge_all which removes all objects from session. Is there a way I can > expunge all objects from certain type? > > We're transitioning from SQLObject, which rev

[sqlalchemy] Remove all objects of specified type from session

2019-01-29 Thread Daniel Leon
There is the method expunge which removes specified object from session and expunge_all which removes all objects from session. Is there a way I can expunge all objects from certain type? We're transitioning from SQLObject, which reveals its cache dictionary. There are many places where we 'exp

[sqlalchemy] Re: How can I get the field names from an object?

2019-01-29 Thread dan . bar . dov
This is almost but not quite what I want. In your example, if the dictionary includes keys that do not map to object fields, it will throw. I want to try and 'cherry-pick' fields of the object from the dictionary. With the introspect you gave me I can do that. Thanks, Dan On Monday, January 28,

[sqlalchemy] Re: How can I get the field names from an object?

2019-01-29 Thread dan . bar . dov
This is doing almost, but not quite what I want. If the dictionary includes entries which are NOT fields in the object, On Monday, January 28, 2019 at 1:57:44 PM UTC+2, dan.b...@huawei.com wrote: > > > Lets say I have a class > > class Dog(AlchemyBase): > __tablename__ = 'dogs' > name =