Skip to content

feat: list_tables accepts a DatasetListItem #588

@tswast

Description

@tswast

Is your feature request related to a problem? Please describe.

Code:

for dataset in bqclient.list_datasets():
    tables = list(bqclient.list_tables(dataset, max_results=1))
    if len(tables) == 0:
        bqclient.delete_dataset(dataset)

Output:

Traceback (most recent call last):
  File "2021/04-test-dataset-cleanup/cleanup.py", line 11, in <module>
    tables = len(bqclient.list_tables(dataset, max_results=1))
  File "/Users/swast/miniconda3/envs/scratch/lib/python3.8/site-packages/google/cloud/bigquery/client.py", line 1327, in list_tables
    raise TypeError("dataset must be a Dataset, DatasetReference, or string")
TypeError: dataset must be a Dataset, DatasetReference, or string

Describe the solution you'd like

Where Dataset or DatasetReference is accepted, also accept a DatasetListItem.

Describe alternatives you've considered

I know that we created DatasetListItem.reference, which I can use, but it'd be a bit more intuitive if I didn't have to.

Additional context

N/A

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-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