Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using deprecated BaseQuery #85

Merged
merged 2 commits into from
Feb 13, 2024
Merged

Conversation

FrostyX
Copy link
Member

@FrostyX FrostyX commented Nov 26, 2023

Fix #84

>>> from flask_sqlalchemy import BaseQuery
DeprecationWarning: 'BaseQuery' has been moved and renamed to
'query.Query'. The top-level import is deprecated and will be
removed in Flask-SQLAlchemy 3.1.

Fix fedora-copr#84

    >>> from flask_sqlalchemy import BaseQuery
    DeprecationWarning: 'BaseQuery' has been moved and renamed to
    'query.Query'. The top-level import is deprecated and will be
    removed in Flask-SQLAlchemy 3.1.
@FrostyX
Copy link
Member Author

FrostyX commented Nov 26, 2023

I am not sure if I am reading the test outputs correctly. Some older python version fails with

  File "/github/workspace/flask_whooshee.py", line 18, in <module>
    from flask_sqlalchemy.query import Query
ModuleNotFoundError: No module named 'flask_sqlalchemy.query'

Is it still relevant? Should I make the import conditional? The other tests starts fine but then they are canceled, I don't know about this (probably to save resources since the other test already failed?).

@greyli
Copy link
Collaborator

greyli commented Feb 13, 2024

The flask_sqlalchemy.query module was introduced in the 3.0.0 version, which requires Python > 3.7. That's why the tests for Python 3.6 failed. I would recommend using the following way to import the query class:

try:
    from flask_sqlalchemy.query import Query
except ImportError:
    from flask_sqlalchemy import BaseQuery as Query

Fixed in eac6dd2 (#85)

@greyli greyli mentioned this pull request Feb 13, 2024
@greyli greyli merged commit 5a337a8 into fedora-copr:main Feb 13, 2024
8 checks passed
@greyli
Copy link
Collaborator

greyli commented Feb 13, 2024

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip install does not work (v0.9.0)
2 participants