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

Update dbapi method to import_dbapi for APSWGSheetsDialect to remove warning at the start of program #387

Closed
AndrewFucher opened this issue Sep 8, 2023 · 2 comments · Fixed by #397

Comments

@AndrewFucher
Copy link

Is your feature request related to a problem? Please describe.
For newer versions of SQLAlchemy (2.0), usage of dbapi() class method is deprecated. It is recommended to implement import_dbapi() class method. Docs
So, the following warning is shown every time I use SQLAlchemy with Google Sheets adapter:

SADeprecationWarning: The dbapi() class method on dialect classes has been renamed to import_dbapi().  Implement an import_dbapi() class method directly on class <class 'shillelagh.backends.apsw.dialects.gsheets.APSWGSheetsDialect'> to remove this warning; the old .dbapi() class method may be maintained for backward compatibility.

Describe the solution you'd like
I would like to update the base class APSWDialect. Remove (if it does not break anything, I am not sure how it really works rn) or extend the class with the class method import_dbapi.

Describe alternatives you've considered
Leaving as it is for now. But as it is deprecated, better follow the docs.

Additional context
Python 3.11
SQLAlchemy==2.0.20
importlib-metadata==6.8.0 (without it SQLAlchemy, ORM to be exact, does not work)

@betodealmeida
Copy link
Owner

betodealmeida commented Sep 19, 2023

@AndrewFucher do you want to write a PR? All you need to do is add:

import_dbapi = dbapi

Here:

@betodealmeida
Copy link
Owner

Added in #452.

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

Successfully merging a pull request may close this issue.

2 participants