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

Is async support available? #1071

Open
eshwen opened this issue May 2, 2024 · 1 comment
Open

Is async support available? #1071

eshwen opened this issue May 2, 2024 · 1 comment
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@eshwen
Copy link

eshwen commented May 2, 2024

Issue

I have a large codebase with several intensive queries to BigQuery. I'm trying to port these synchronous queries to async to improve performance, but am unable to create an async SQLAlchemy engine. Is there a specific dialect and/or driver I can provide in order to enable async functionality? Or is there an easy workaround?

MWE

A simple script:

from sqlalchemy.ext.asyncio import create_async_engine

conn_path = "bigquery://"
engine = create_async_engine(conn_path)

Resulting in the traceback

Traceback (most recent call last):
  File "/Users/eshwen.bhal/Library/Application Support/JetBrains/PyCharm2024.1/scratches/scratch_6.py", line 4, in <module>
    engine = create_async_engine(conn_path)
  File "/Users/eshwen.bhal/Documents/GitHub/mjolnir/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/engine.py", line 118, in create_async_engine
    return AsyncEngine(sync_engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/eshwen.bhal/Documents/GitHub/mjolnir/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/engine.py", line 1023, in __init__
    raise exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async driver to be used. The loaded 'bigquery' is not async.

Environment

  • Python: 3.11.8
  • SQLAlchemy: 2.0.28
  • sqlalchemy-bigquery: 1.11.0
  • Chip: Apple M2 Pro
  • OS: macOS 14.4.1
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. label May 2, 2024
@Linchin Linchin added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Jun 5, 2024
@Linchin
Copy link
Contributor

Linchin commented Jun 5, 2024

Thank you for raising this issue. This feature will be dependent on async support in googleapis/python-bigquery. Please see googleapis/python-bigquery#18 for future updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants