Sitelet https://github.com/googleapis/python-spanner/issues/156
Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

FR: Adding additional functions in the API library #156

Description

@freedomofnet

Is your feature request related to a problem? Please describe.

The current Google.cloud.spanner library has very limited functionalities compared to other db libraries (e.g., bigquery) and some of the key APIs are missing. For example,

get_table
table
list_tables
schema
query
execute

I would like to have the above functions added to the library.

Describe the solution you'd like

These functions could be implementable via the INFORMATION_SCHEMA query syntax.

Activity

  1. added
    priority: p3Desirable enhancement or fix. May not be included in next release.
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Oct 21, 2020
  2. larkee commented on Nov 4, 2020

    @larkee
    Contributor

    Hi there,

    Thank you for filing this issue. I've been working on preparing the 2.0.0 release of the library which has blocked me from doing any work on this request. However, that work is nearly complete which means I'll be free for feature work again. As such, I wanted to get some more details on the APIs you mentioned.

    Would you be able to explain what the expectation is for each of these APIs and give a code example of the usage? From looking over the BigQuery documentation, it seems the way the APIs are structured is quite different and so I'm not sure having a Table object would make as much sense in Spanner.

    As a note, I believe the functionality of query and execute are implemented however the way to call them may differ. For example, this shows how to run a SQL query against a Spanner database:

    from google.cloud import spanner
    
    client = spanner.Client()
    instance = client.instance('instance-id')
    database = instance.database('database-id')
    
    with database.snapshot() as snapshot:
        results = snapshot.execute_sql("SQL QUERY")
    
        for row in results:
            ...
    

    Please let me know what the intended usage is so I can better consider what the best option is. 👍

  3. tswast commented on Nov 21, 2020

    @tswast
    Contributor

    Regarding Table, this would map to INFORMATION_SCHEMA queries for fetching table metadata (schema/columns being the most important piece). Perhaps there could be a get_table and list_tables method which just executes relevant information schema queries?

  4. tswast commented on Nov 21, 2020

    @tswast
    Contributor

    The intended use case is for an Ibis connector, which provides runtime helpers for generating and validating analytical queries.

    P.S. I agree that query / execute are a bit nonsensical asks. The existing execute_sql command is sufficient. (I think this was included in the Ibis project scope due to the need to convert the streamed result set into a pandas dataframe: googleapis/google-cloud-python#15927)

  5. larkee commented on Dec 15, 2020

    @larkee
    Contributor

    Thanks for your patience!

    As part of the Django connector work, a dbapi adapter was implemented and now lives in this repo under google/cloud/spanner_dbapi. This adapter adds some of the functionalities you mentioned.

    Unfortunately, I don't have any cycles to work on any missing methods you may need. However, I am happy to review any PRs you may open in regards to this issue.

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

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/python-spanner API.priority: p3Desirable enhancement or 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