镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

BigQuery should have a module that follows the DB-API to allow for a SQLAlchemy dialect #2434

Closed

Description

@tswast

There is a module to connect SQLAlchemy to BigQuery, but it only has partial support. I'd love to be able to connect to BigQuery using SQLAlchemy this way and be able to play with Caravel as was mentioned in that partial support issue.

To do this properly, we'd need to provide a module with an implementation of a SQLAlchemy dialect I would imagine we'd want to package this separately so as not to add a dependency on SQLAlchemy. Looking more closely at the dialect interface it looks like the database driver would need to implement the Python DB-API.

I'm considering this a low priority feature request, but do think it would be cool.

Activity

  1. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    api: bigqueryIssues related to the BigQuery API.
    on Sep 26, 2016
  2. arita37 commented on Nov 24, 2016

    @arita37

    This is a good topic, very useful.

  3. tseaver commented on Nov 29, 2016

    @tseaver
    Contributor

    @tswast BigQuery's DML support is still marked as experimental: I would want to see some API stability commitment on the back-end before trying to implement DB-API semantics.

  4. self-assigned this
    on Dec 29, 2016
  5. jkilpatricksc commented on Jan 21, 2017

    @jkilpatricksc

    I'd like to use this on my projects. Are there plans to build support?

  6. tswast commented on Jan 22, 2017

    @tswast
    ContributorAuthor

    @jkilpatricksc I have a pull request open, but it's not complete. Working on it!

  7. arita37 commented on Jan 31, 2017

    @arita37

    There is some tentative of plugging sql alchemy:
    https://pypi.python.org/pypi/sqlalchemy_bigquery/

    Having Big Query connector to SQL Alchemy would give a strong incentive to use Big Query

  8. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Apr 19, 2017
  9. mistercrunch commented on May 13, 2017

    @mistercrunch
    Contributor

    Maintainer on Superset here (https://github.com/airbnb/superset)

    @tswast I'm curious to hear how far you made it. It seems like it should be fairly straightforward to mimic DBAPI and to define a SQLAlchemy dialect. Note that the dialect can be incomplete and limited to work for read, as [of course] you wouldn't use DML or expect to use an ORM on top BigQuery. Also there's a need to implement the metadata-fetching methods to allow us to fetch metadata around tables/views/columns/types.

    For reference, the pyhive project (https://github.com/dropbox/PyHive) does exactly this (mimic DBAPI and defines a SQLAlchemy dialect) on top of Presto and Hive, and it works very well for Superset and other interfaces. It's really nice to have a common interface (sqlalchemy) to all databases for people building tools that are expected to work against many databases.

  10. tswast commented on May 15, 2017

    @tswast
    ContributorAuthor

    I paused my work on #2921 but am restarting it now. I'm glad to hear there's interest in this.

  11. tseaver commented on May 31, 2017

    @tseaver
    Contributor

    #3460, now merged, added query.num_dml_affected_rows, needed to implement cursor.rowcount.

  12. tswast commented on Jul 12, 2017

    @tswast
    ContributorAuthor

    The DB-API implementation #2921 is now merged.

    I've filed #3603 to track SQLAlchemy support.

  13. tswast commented on Dec 11, 2017

    @tswast
    ContributorAuthor
  14. added a commit that references this issue on Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions