Description
I thought 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 bigquery
client = bigquery.Client()
dataset_id = 'my_dataset' # replace with your dataset ID
table_id = 'my_table' # replace with your table ID
table_ref = client.dataset(dataset_id).table(table_id)
table = client.get_table(table_ref) # API request
I 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 a Table
object while a dataset object does return a Dataset
object / do we need a TableReference
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.