Re: [sqlalchemy] Where clause when using polymorphic_identity on base class

2019-06-27 Thread Dmytro Starosud
I see, thank you, Mike. So, looks like I just wanted strange thing: having class to be distinct from itself. Thank you for clarifying! Dmytro вт, 25 черв. 2019 о 19:26 Mike Bayer пише: > > > On Fri, Jun 21, 2019, at 7:22 AM, Dmytro Starosud wrote: > > Base cl

Re: [sqlalchemy] Where clause when using polymorphic_identity on base class

2019-06-25 Thread Dmytro Starosud
> you are storing, and how you are structuring your class hierarchy? > > Thanks, > > Simon > > On Fri, Jun 21, 2019 at 1:30 PM Dmytro Starosud > wrote: > > > > Thanks for your reply! > > > > > you could probably insert another class as the parent of

Re: [sqlalchemy] Where clause when using polymorphic_identity on base class

2019-06-21 Thread Dmytro Starosud
kind of (possibly specialized) A1. > > However, if you query for A2, you will only get rows that are > specifically A2, A2a or A2b. > > If you don't want this behaviour, you could probably insert another > class as the parent of A1, with no polymorphic identity. At that > poin

[sqlalchemy] Where clause when using polymorphic_identity on base class

2019-06-21 Thread Dmytro Starosud
Base class A1 contains polymorphic_identity (along with polymorphic_on), but Query(A1)doesn't produce where clause, whereas Query(A2) (where A2 is subclass of A1 with its own polymorphic_identity) does. Tried looking in docs with no success. I think I am just missing something. from

Re: [sqlalchemy] Event handler execution order for the same target/identifier

2018-09-18 Thread Dmytro Starosud
Thanks a lot Mike! вт, 18 вер. 2018 о 16:07 Mike Bayer пише: > On Tue, Sep 18, 2018 at 7:07 AM Dmytro Starosud > wrote: > > > > Hello group > > > > Please help me with the following. Imagine I have: > > > > @event.listens_for(Session, 'before_

[sqlalchemy] Event handler execution order for the same target/identifier

2018-09-18 Thread Dmytro Starosud
Hello group Please help me with the following. Imagine I have: @event.listens_for(Session, 'before_flush') def one(session, flush_context, instances): pass @event.listens_for(Session, 'before_flush') def two(session, flush_context, instances): pass I.e. two handlers for the same

[sqlalchemy] join Query.from_statement

2018-06-10 Thread Dmytro Starosud
Hello guys! I am trying to join two models by relationship, but I want to emulate values of second model using from_statement. class X(Base): __tablename__ = 'x' id = Column(Integer, primary_key=True) class Y(Base): __tablename__ = 'y' id = Column(Integer, primary_key=True)