-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 usage docs do not explain references #4930
Comments
Yes, this could use some additional explanation in the docs. The main purpose of It is possible to go from a To go from a reference to a full object, use the client to fetch the full object from the API with get_table() or get_dataset(). If a |
Note: the usage docs do have examples for I agree that examples using the |
Thanks for your comments here. It'd be really helpful to have this in the documentation! |
I did find this very confusing. For example, Is this something we're coupled to because of the REST API? Could we at least add options to supply strings, so Overall, the API is extremely class-heavy for a python library. A recent frustrating example was |
It's funny you mention that method. It's probably the only thing that didn't change in the 0.27 to 0.28 rewrite. In 0.27 and earlier, the
In my first version of the rewrite, I proposed exactly this (allowing either string or reference), but the number of combinations exploded pretty fast. Some folks on the Datalab / Colab teams gave me some feedback that only allowing references would greatly simplify the implementation (which I do agree it did accomplish that). For example, one trouble with Also, yes we are slightly tied to having reference objects because of the REST API. For example, there are 16 instances of TableReference in the Jobs resource alone. https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs In 0.27, the Python API again pretended these were full Table objects but they only had the ID fields populated, which I thought was even more confusing.
True, it's not an iterator. But it is an iterable. For example |
Thanks for the reply @tswast I still don't understand what a It sounds like you've thought about it a lot, so I pause in humility. But I remain confused why (I think) this is what's currently required to create a dataset, where I would have expected dataset = client.create_dataset(
bigquery.Dataset(
client.dataset(dataset_name)
)
)
Yes that's fair, and my original comment probably wasn't balanced. Still, calling |
Honestly since the REST API separates everything out like
it hadn't crossed my mind to accept a fully-qualified dataset ID. I would be open to a PR that modifies Dataset to accept strings like "project.dataset" as an option where there is a Dataset reference. |
Re: my previous comment. I've sent #5255 to add |
The BigQuery usage docs do not explain what
TableReference
s are, when/why you'd need to use one instead of aTable
, and how to get aTableReference
from aTable
or vice versa.(And similarly for
DatasetReference
s andDataset
s.)The text was updated successfully, but these errors were encountered: