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

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

Closed
salvador-bynd opened this issue Apr 30, 2019 · 6 comments · Fixed by #9161
Closed

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

salvador-bynd opened this issue Apr 30, 2019 · 6 comments · Fixed by #9161
Assignees
Labels
api: bigquery Issues related to the BigQuery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@salvador-bynd
Copy link

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
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label May 1, 2019
@tseaver tseaver added api: bigquery Issues related to the BigQuery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels May 1, 2019
@joncass
Copy link

joncass commented May 21, 2019

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?

@tswast
Copy link
Contributor

tswast commented Aug 26, 2019

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

@emar-kar
Copy link
Contributor

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

@plamut
Copy link
Contributor

plamut commented Aug 30, 2019

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

@emar-kar
Copy link
Contributor

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

@plamut plamut assigned plamut and emar-kar and unassigned plamut Aug 30, 2019
@plamut
Copy link
Contributor

plamut commented Aug 30, 2019

@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
Labels
api: bigquery Issues related to the BigQuery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
7 participants