PyBigQuery is an **obsolete** SQLAlchemy dialect for Google BigQuery. It is no longer actively maintained and should not be used for new projects. The last version released was 0.10.2, in 2019. Users are strongly advised to migrate to `google-cloud-bigquery-sqlalchemy` (PyPI package `google-cloud-bigquery-sqlalchemy`, GitHub repository `googleapis/python-bigquery-sqlalchemy`) which is the actively maintained and modern successor.
pip install pybigqueryVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates establishing a connection to Google BigQuery using the obsolete PyBigQuery dialect with SQLAlchemy. It relies on standard Google Cloud authentication. This code is provided for historical reference; users should migrate to `google-cloud-bigquery-sqlalchemy` for any new development or maintenance.
Immediately plan and execute migration of your project to `google-cloud-bigquery-sqlalchemy`. Update your `requirements.txt` and review any specific BigQuery features used, as API details or supported functionalities may differ slightly or be expanded in the successor library.
If absolutely necessary to use PyBigQuery, confine your environment to Python 3.9 or earlier. The recommended long-term fix is to migrate to `google-cloud-bigquery-sqlalchemy`, which supports modern Python versions.
Use SQLAlchemy 1.x API patterns if stuck with PyBigQuery. However, `google-cloud-bigquery-sqlalchemy` provides full SQLAlchemy 2.0 compatibility and is the recommended solution.
Always verify the package name you `pip install` against the documentation you are consulting. The GitHub repository linked from `pybigquery`'s PyPI page is for `google-cloud-bigquery-sqlalchemy`.
Downgrade your Python environment to 3.9 or earlier, or (strongly recommended) migrate your project to use `google-cloud-bigquery-sqlalchemy`.
Ensure `pybigquery` is correctly installed in your active environment: `pip install pybigquery`. If the problem persists, try `pip install --force-reinstall pybigquery`.
Ensure you are using SQLAlchemy 1.x API patterns (e.g., `connection.execute(text(...))`). However, this is a strong indication that migration to `google-cloud-bigquery-sqlalchemy` is overdue for full SQLAlchemy 2.0 support.
Verify the `project_id` and `dataset_id` in your connection string. Confirm your Google Cloud credentials (e.g., `GOOGLE_APPLICATION_CREDENTIALS` environment variable or `gcloud auth application-default login`) have 'BigQuery Data Viewer' and 'BigQuery Job User' roles for the specified project and dataset.
PyBigQuery is a SQLAlchemy dialect plugin. You generally don't import directly from it. Instead, you import `create_engine` from `sqlalchemy` and use a `bigquery://` connection string. The `pybigquery` package only needs to be installed to register the dialect.