art1415926535 / graphene-sqlalchemy-filter

Filters for Graphene SQLAlchemy integration
https://pypi.org/project/graphene-sqlalchemy-filter/
MIT License
118 stars 34 forks source link

ambiguous column exception in _get_query in connection_field.py #51

Open maquino1985 opened 3 years ago

maquino1985 commented 3 years ago

the query generated by subquery when using filters unambiguously labeling columns resulting in an ambiguous column exception.

long story short, I have a polymorphic database, so id is shared between a base class and the filtered child class. that seems to be the root of the issue. after playing around for a while I found subquery.subquery() has a with_labels argument you can pass. setting that to True fixed the issue for me

e.g. connection_field.py line 250

      aliased_model = aliased(self.model, subquery.subquery(with_labels=True))
maquino1985 commented 2 years ago

hey @art1415926535 can you look at this and/or add this? I don't want to make another forked library to maintain and this simple change fixes a critical issue and should cause no side effects