- Notifications
You must be signed in to change notification settings - Fork1.6k
Description
Ithought I'd discussed this with@tswast, and he'd even generously added a PR; but after ten mins of searching GH I've come up empty on both issues and PRs, so posting here.
@tswast lmk if my memory is correct and we have discussed this!
I appreciate API design is difficult and there are tradeoffs between verbosity vs explicitness, and consistency within a product vs language-specific adjustments. The bar should be high for people offering criticism when they can only see a subset of the relevant information.
But I do frequently use the BQ python API and find it fairly awkward and un-pythonic, as though I were writing Java.
Here's an example, straight from the docs:
from google.cloud import bigqueryclient = bigquery.Client()dataset_id = 'my_dataset' # replace with your dataset IDtable_id = 'my_table' # replace with your table IDtable_ref = client.dataset(dataset_id).table(table_id)table = client.get_table(table_ref) # API requestI would love to be able to write this, and receive a table object.
client = bigquery.Client()client.table(dataset='ds', table='tbl')There are some points a level down (the.table object doesn't return aTable object while a dataset object does return aDataset object / do we need aTableReference class in place of a string, etc), but they all center around the ergonomics of the API, particularly in respect to Python.
Thank you as ever for a wonderful product, and appreciate any thoughts on whether I'm making mistakes here.