Re: [sqlalchemy] How to get ForeignKey from Relationship property

2018-04-11 Thread Tolstov Sergey
Thanks for answer. I dynamicly create classes, their columns, their relationship. Add new works with new_instances, who will load after defintion, and already loaded classes who doesn't contain foreignkeys(for relationships). session.expire(attribute), does not work, because contained foreign key

Re: [sqlalchemy] mapping a class against multiple tables + relationship() .. ?

2018-04-11 Thread Mike Bayer
On Wed, Apr 11, 2018 at 6:15 AM, Julien Cigar wrote: > On Tue, Apr 10, 2018 at 11:53:09AM -0400, Mike Bayer wrote: >> On Tue, Apr 10, 2018 at 9:28 AM, Julien Cigar wrote: >> > Hello, >> > >> > I wondered if it is possible to use a class mapped

Re: [sqlalchemy] mapping a class against multiple tables + relationship() .. ?

2018-04-11 Thread Julien Cigar
On Tue, Apr 10, 2018 at 11:53:09AM -0400, Mike Bayer wrote: > On Tue, Apr 10, 2018 at 9:28 AM, Julien Cigar wrote: > > Hello, > > > > I wondered if it is possible to use a class mapped against multiple > > tables as a relationship() in another class? > > it is, there's

Re: [sqlalchemy] How to get ForeignKey from Relationship property

2018-04-11 Thread Simon King
On Wed, Apr 11, 2018 at 7:40 AM, Tolstov Sergey wrote: > I use dynamic constructor for class. > It works fine for instance who have not foreign keys. But when FK on another > instance it cannot load them > > Example: > class left (Base): > id = sqlalchemy.Column(UUID,

[sqlalchemy] How to get ForeignKey from Relationship property

2018-04-11 Thread Tolstov Sergey
I use dynamic constructor for class. It works fine for instance who have not foreign keys. But when FK on another instance it cannot load them Example: class left (Base): id = sqlalchemy.Column(UUID, primary_key = True) def __getattr__(self, attribute): if attribute == 'rights':