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

2019-06-21 Thread Simon King
The extra base class is only needed once per inheritance hierarchy. Do you have a hundred of those? Do you mind if I ask what kind of data 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

Re: [sqlalchemy] Masking SAWarning: Flushing object ... with incompatible polymorphic identity

2019-06-21 Thread Mike Bayer
On Fri, Jun 21, 2019, at 2:14 AM, Chris Withers wrote: > On 20/06/2019 16:00, Mike Bayer wrote: > > > >> On Thu, Jun 20, 2019, at 3:14 AM, Chris Withers wrote: > >>> Hi All, > >>> > >>> I'm getting this warning: > >>> > >>> SAWarning: Flushing object with incompatible > >>> polymorphic

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

2019-06-21 Thread Dmytro Starosud
Thanks for your reply! > you could probably insert another class as the parent of A1, with no polymorphic identity. This is what I would like to avoid. Otherwise I would need to write some metaclass machinery to inject base class for all hundred models I have. Originally I am going to add this

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

2019-06-21 Thread Simon King
>From a quick test, this appears to be special behaviour for the base class in an inheritance hierarchy. If you extend your test like this: from sqlalchemy import Column, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import Query, configure_mappers

[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] primaryjoin and remote/foreign sides

2019-06-21 Thread Julien Cigar
On Thursday, June 20, 2019 at 4:24:14 PM UTC+2, Mike Bayer wrote: > > > > On Thu, Jun 20, 2019, at 8:39 AM, Julien Cigar wrote: > > > > On Wednesday, June 19, 2019 at 9:53:42 PM UTC+2, Mike Bayer wrote: > > > > On Wed, Jun 19, 2019, at 10:50 AM, Julien Cigar wrote: > > That's the (almost) final

Re: [sqlalchemy] Masking SAWarning: Flushing object ... with incompatible polymorphic identity

2019-06-21 Thread Chris Withers
On 20/06/2019 16:00, Mike Bayer wrote: On Thu, Jun 20, 2019, at 3:14 AM, Chris Withers wrote: Hi All, I'm getting this warning: SAWarning: Flushing object with incompatible polymorphic identity ; the object may not refresh and/or load correctly (this warning may be suppressed after 10

Re: [sqlalchemy] Masking SAWarning: Flushing object ... with incompatible polymorphic identity

2019-06-21 Thread Chris Withers
On 20/06/2019 16:00, Mike Bayer wrote: this is not reproducing for me: from sqlalchemy import util import warnings from sqlalchemy import exc warnings.filterwarnings("ignore", category=exc.SAWarning) util.warn_limited(     "Flushing object %s with "     "incompatible polymorphic identity

Re: [sqlalchemy] Re: Masking SAWarning: Flushing object ... with incompatible polymorphic identity

2019-06-21 Thread Chris Withers
On 20/06/2019 18:50, Jonathan Vanasco wrote: On Thursday, June 20, 2019 at 3:14:06 AM UTC-4, Chris Withers wrote: How can I indicate in my code that this is intentional and no warning should be omitted? Personal option: I would not mask these.  I would let them persist and

Re: merging old versions

2019-06-21 Thread Chris Withers
>> On Thu, Jun 20, 2019 at 2:37 AM Chris Withers > > wrote: >> >> Hi All, >> >> I have some versions that make use of the third party package I no >> longer use, how do I collapse down alembic revisions that have >> already >> been executed