Re: [sqlalchemy] Parent object from collection class

2017-07-26 Thread Asif Mahmud
Thank you so much to take the time for helping me out. Best wishes - Asif Mahmud Shimon On Thu, Jul 27, 2017 at 3:37 AM, Mike Bayer wrote: > On Wed, Jul 26, 2017 at 5:22 PM, Asif Mahmud wrote: > > So, doing it like this - parent = > >

Re: [sqlalchemy] Parent object from collection class

2017-07-26 Thread Mike Bayer
On Wed, Jul 26, 2017 at 5:22 PM, Asif Mahmud wrote: > So, doing it like this - parent = > collections.collection_adapter(self).owner_state.obj() where self is the > collection object. is it correct? here's how you test that: from sqlalchemy import * from sqlalchemy.orm

Re: [sqlalchemy] Parent object from collection class

2017-07-26 Thread Asif Mahmud
So, doing it like this - *parent = collections.collection_adapter(self).owner_state.obj()* where self is the collection object. is it correct? Best wishes - Asif Mahmud Shimon On Thu, Jul 27, 2017 at 3:16 AM, Mike Bayer wrote: > On Wed, Jul 26, 2017 at 5:15 PM, Asif

Re: [sqlalchemy] Parent object from collection class

2017-07-26 Thread Mike Bayer
On Wed, Jul 26, 2017 at 5:15 PM, Asif Mahmud wrote: > I walked through the dir of self and found this statement is the parent > object - self._sa_adapter.owner_state.object . Is it safe to use this object > for making more queries inside append method? no, because

Re: [sqlalchemy] Parent object from collection class

2017-07-26 Thread Asif Mahmud
I walked through the dir of self and found this statement is the parent object - *self._sa_adapter.owner_state.object *. Is it safe to use this object for making more queries inside append method? Best wishes - Asif Mahmud Shimon On Thu, Jul 27, 2017 at 1:32 AM, Mike Bayer

Re: [sqlalchemy] Parent object from collection class

2017-07-26 Thread Mike Bayer
On Jul 26, 2017 1:18 PM, "Asif Mahmud" wrote: Hi, Is there a way to get/retrieve the parent object from a collection class's append/add method ? >From the method, call im_self to get the collection object itself, then use collection_adapter (

[sqlalchemy] Parent object from collection class

2017-07-26 Thread Asif Mahmud
Hi, Is there a way to get/retrieve the parent object from a collection class's append/add method ? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See