graphene-sqlalchemy-filter icon indicating copy to clipboard operation
graphene-sqlalchemy-filter copied to clipboard

Fix RemovedIn20Warning

Open sobolevbel opened this issue 1 year ago • 0 comments

There's an sqlalchemy deprecation warning in the library. I think it should be fixed.

graphene_sqlalchemy_filter/connection_field.py:259: RemovedIn20Warning: Using strings to indicate column or relationship paths in loader options is deprecated and will be removed in SQLAlchemy 2.0. Please use the class-bound attribute directly. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)

It seems like self.parent_model_pks is a sequence of strings in the current code:

Load(self.parent_model).load_only(*self.parent_model_pks)

We need to use a new approach with class attributes instead of strings like:

Load(Model).load_only(Model.attr, Model.another_attr)

Versions: graphene-sqlalchemy-filter==1.13.0 SQLAlchemy==1.3.11

sobolevbel avatar Nov 28 '23 19:11 sobolevbel