Re: [sqlalchemy] Multiple mappers found by get_mapper - model inheritance

2021-05-27 Thread piotr maliński
That seems to help. I'll make an issue for it. śr., 26 maj 2021 o 18:16 Mike Bayer napisał(a): > OK then please report this as a bug in sqlalchemy-utils > > right now they are not looking at local table > > looking at the code here: > https://sqlalchemy-utils.readthedocs.io/en/latest/_modules/sq

Re: [sqlalchemy] Multiple mappers found by get_mapper - model inheritance

2021-05-26 Thread Mike Bayer
OK then please report this as a bug in sqlalchemy-utils right now they are not looking at local table looking at the code here: https://sqlalchemy-utils.readthedocs.io/en/latest/_modules/sqlalchemy_utils/functions/orm.html#get_mapper code can be like: mappers = [ mapper for

Re: [sqlalchemy] Multiple mappers found by get_mapper - model inheritance

2021-05-26 Thread piotr maliński
It's from sqlalchemy_utils - https://sqlalchemy-utils.readthedocs.io/en/latest/orm_helpers.html#get-mapper śr., 26 maj 2021 o 17:47 Mike Bayer napisał(a): > get_mapper() is not part of SQLAlchemy where is it? > > On Wed, May 26, 2021, at 9:35 AM, piotr maliński wrote: > > AnnotatedTable doesn't

Re: [sqlalchemy] Multiple mappers found by get_mapper - model inheritance

2021-05-26 Thread Mike Bayer
get_mapper() is not part of SQLAlchemy where is it? On Wed, May 26, 2021, at 9:35 AM, piotr maliński wrote: > AnnotatedTable doesn't have a mapper so I call: > > get_mapper(annotated_table_object_here) > > To then map a column name to a column on a model with _entity_descriptor. In > get_mapper

Re: [sqlalchemy] Multiple mappers found by get_mapper - model inheritance

2021-05-26 Thread piotr maliński
AnnotatedTable doesn't have a mapper so I call: get_mapper(annotated_table_object_here) To then map a column name to a column on a model with _entity_descriptor. In get_mapper this seems to hit the "if isinstance(mixed, sa.Table):" branch and: if mixed in mapper.tables ends true to all 3 of the

Re: [sqlalchemy] Multiple mappers found by get_mapper - model inheritance

2021-05-26 Thread Mike Bayer
I would need to see what get_mapper() is doing. the best way to associate the relevant table to a mapper is to look at inspect(Class).mapper.local_table. On Wed, May 26, 2021, at 9:18 AM, Piotr wrote: > I'm updating "sqlalchemy_django_query" for SQLAlchemy 1.4 and aside of that I > found a p

[sqlalchemy] Multiple mappers found by get_mapper - model inheritance

2021-05-26 Thread Piotr
I'm updating "sqlalchemy_django_query" for SQLAlchemy 1.4 and aside of that I found a peculiar problem - when I call get_mapper on a table (AnnotatedTable) I get a ValueError due to multiple mappers found. The model is inherited by two other models and get_mapper finds mappers for all 3 models