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

Deprecation warning when querying Google Sheets via SQLAlchemy #505

Open
glyzinieh opened this issue Feb 6, 2025 · 2 comments
Open

Deprecation warning when querying Google Sheets via SQLAlchemy #505

glyzinieh opened this issue Feb 6, 2025 · 2 comments
Assignees
Labels

Comments

@glyzinieh
Copy link

I'm not fluent in English, so some expressions may be unnatural. Sorry.

Describe the bug
A SADeprecationWarning occurs when executing a query.

To Reproduce

  1. Run the following code:
from sqlalchemy import text
from sqlalchemy.engine import create_engine

engine = create_engine(
    "gsheets://",
    catalog={
        "simple_sheet": "https://docs.google.com/spreadsheets/d/1_rN3lm0R_bU3NemO0s9pbFkY5LQPcuy1pscv8ZXPtg8/edit?headers=1#gid=0"
    },
)
connection = engine.connect()
connection.execute(text("SELECT * FROM simple_sheet"))
  1. The following warning is displayed:
SADeprecationWarning: The dbapi() classmethod on dialect classes has been renamed to import_dbapi(). Implement an import_dbapi() classmethod directly on class <class 'shillelagh.backends.apsw.dialects.gsheets.APSWGSheetsDialect'> to remove this warning; the old .dbapi() classmethod may be maintained for backwards compatibility.

Expected behavior
The query should execute without any deprecation warnings.

Environment

  • Python version: 3.13.2
  • Installed packages (pip freeze output):
apsw==3.48.0.0
attrs==25.1.0
cachetools==5.5.1
cattrs==24.1.2
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
cryptography==44.0.0
google-auth==2.38.0
greenlet==3.1.1
idna==3.10
packaging==24.2
platformdirs==4.3.6
pyasn1==0.6.1
pyasn1_modules==0.4.1
pycparser==2.22
pyOpenSSL==25.0.0
python-dateutil==2.9.0.post0
requests==2.32.3
requests-cache==1.2.1
rsa==4.9
shillelagh==1.3.4
six==1.17.0
SQLAlchemy==2.0.37
typing_extensions==4.12.2
url-normalize==1.4.3
urllib3==2.3.0

Additional context
It seems that dbapi() has been deprecated in favor of import_dbapi(). Could you provide guidance on how to resolve this warning?

@betodealmeida betodealmeida self-assigned this Feb 11, 2025
@betodealmeida
Copy link
Owner

Huh, weird because it's defined on the base class. I wonder if it needs to be defined directly in the subclass. I'll fix it.

@glyzinieh
Copy link
Author

glyzinieh commented Feb 12, 2025

Thanks for your support.
I saw #387 and #452. I think it's weird too.

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

No branches or pull requests

2 participants