Skip to content

BigQuery: Table.from_string() doesn't support GCP project ID with org prefix #7827

Closed

Description

@salvador-bynd

Environment details

  1. BigQuery
  2. Google App-Engine standard (Python 2.7)
  3. Python 2.7
  4. google-cloud-bigquery==1.10.0

Code example

from google.cloud import bigquery
from google.cloud.bigquery import Table

# Standard SQL (works fine)
# SELECT * FROM `google.com:my-project.mydataset.mytable` LIMIT 1

# Works fine
table = Table.from_string('my-project.mydataset.mytable')

# Fails
table = Table.from_string('google.com:my-project.mydataset.mytable')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/vv/local/lib/python2.7/site-packages/google/cloud/bigquery/table.py", line 815, in from_string
    return cls(TableReference.from_string(full_table_id))
  File "/tmp/vv/local/lib/python2.7/site-packages/google/cloud/bigquery/table.py", line 246, in from_string
    "got {}".format(table_id)
ValueError: Too many parts in table_id. Must be a fully-qualified table ID in standard SQL format. e.g. "project.dataset.table", got google.com:my-project.mydataset.mytable

Activity

  1. added
    api: bigqueryIssues related to the BigQuery API.
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    triage meI really want to be triaged.
    on May 1, 2019
  2. joncass commented on May 21, 2019

    @joncass

    I am having this same issue. It looks to me like the fix would be to change line https://github.com/googleapis/google-cloud-python/blob/master/bigquery/google/cloud/bigquery/_helpers.py#L590 from parts = full_id.split(".") to parts = full_id.rsplit(".", 2). Any objections to that change?

  3. tswast commented on Aug 26, 2019

    @tswast
    Contributor

    @emar-kar want to take a look at this issue, too? Related to similar fix in #8877

  4. emar-kar commented on Aug 26, 2019

    @emar-kar
    Contributor

    @tswast yeah, sure. I’ll take a look tomorrow.

  5. plamut commented on Aug 30, 2019

    @plamut
    Contributor

    @emar-kar Are you currently working on this? Asking to not unnecessarily duplicate the effort.

  6. emar-kar commented on Aug 30, 2019

    @emar-kar
    Contributor

    @plamut Yeah, thank you for asking. I’m working on it.

  7. assigned and unassigned on Aug 30, 2019
  8. plamut commented on Aug 30, 2019

    @plamut
    Contributor

    @emar-kar Great, thanks. I updated the assignee for better visibility.

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.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