Re: [sqlalchemy] Event do not fire on m2m relation

2019-03-18 Thread Mike Bayer
On Mon, Mar 18, 2019 at 11:07 AM Денис Ралко wrote: > > Thx for your quick answer. > About second question > > I have event, for example > > def track_instances_before_flush(session, context, instances): > for obj in chain(session.new, session.dirty): > if session.is_modified(obj): >

[sqlalchemy] Re: Return null object for outer join relationships, instead of object with all null values

2019-03-18 Thread Gmoney
Ah I'm sorry it does work how I expected... It was being changed after the query elsewhere on my end. -- 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

[sqlalchemy] Re: Return null object for outer join relationships, instead of object with all null values

2019-03-18 Thread Jonathan Vanasco
it's best to post some (executable) code on this to replicate your problem and illustrate it for everyone. -- 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.

[sqlalchemy] Converting existing table to PG11 partitioned table in SA

2019-03-18 Thread Роберт Шотланд
We have a an existing PostgreSQL 9.6 database that we would like to upgrade to PostgreSQL 11 mostly for the purpose of partitioning a large (soon to be huge) table using PostgreSQL Declarative Partitioning. Our database has been implemented with declarative SA ORM with migrations managed by

[sqlalchemy] Return null object for outer join relationships, instead of object with all null values

2019-03-18 Thread Gmoney
I have some relationships setup that are based on outer joins. When the result of the outer join is NULL (ie. it won't join), instead of having a None for that field, I get an object with all None values for that field. Is this as-designed? I can kind of understand why... but the way i"m

Re: [sqlalchemy] Event do not fire on m2m relation

2019-03-18 Thread Денис Ралко
Thx for your quick answer. About second question I have event, for example def track_instances_before_flush(session, context, instances): for obj in chain(session.new, session.dirty): if session.is_modified(obj): print "Before Flush" table_name =

Re: [sqlalchemy] self relationship via intermediate table

2019-03-18 Thread Mike Bayer
On Sat, Mar 16, 2019 at 9:33 AM kosta wrote: > > Hello everyone! > > I've designed invitation model > class User(Base): > __tablename__ = 'user' > > id = Column(Integer, primary_key=True) > name = Column(String(64)) > email = Column(String(64)) > class Invitation(Base): > __tablename__ =

Re: [sqlalchemy] Event do not fire on m2m relation

2019-03-18 Thread Mike Bayer
On Mon, Mar 18, 2019 at 10:30 AM Денис Ралко wrote: > > Hi, I have some issue > > I try implement track logic > I have 2 Models and connecting Table > > My first class > > class MODEL_1(object): > # some values > > # relations: > attr_1 = db.relationship('MODEL_2', >

[sqlalchemy] Event do not fire on m2m relation

2019-03-18 Thread Денис Ралко
Hi, I have some issue I try implement track logic I have 2 Models and connecting Table My first class class MODEL_1(object): # some values # relations: attr_1 = db.relationship('MODEL_2', secondary="test2test", lazy='dynamic',