michalslowikowski00 commented on a change in pull request #8477:
URL: https://github.com/apache/airflow/pull/8477#discussion_r415809735
##########
File path: airflow/providers/google/cloud/hooks/bigquery.py
##########
@@ -349,56 +358,49 @@ def get_dataset_tables(self, dataset_id: str, project_id:
Optional[str] = None,
:param page_token: (Optional) page token, returned from a previous
call,
identifying the result set.
:type page_token: str
-
- :return: map containing the list of tables + metadata.
+ :param retry: How to retry the RPC.
+ :type retry: google.api_core.retry.Retry
+ :return: List of tables associated with the dataset.
"""
- service = self.get_service()
-
- optional_params = {} # type: Dict[str, Union[str, int]]
- if max_results:
- optional_params['maxResults'] = max_results
- if page_token:
- optional_params['pageToken'] = page_token
-
- dataset_project_id = project_id or self.project_id
+ project_id = project_id or self.project_id
- return (service.tables().list( # pylint: disable=no-member
- projectId=dataset_project_id,
- datasetId=dataset_id,
- **optional_params).execute(num_retries=self.num_retries))
+ tables = Client(client_info=self.client_info).list_tables(
+ dataset=DatasetReference(project=project_id,
dataset_id=dataset_id),
+ max_results=max_results,
+ page_token=page_token,
+ retry=retry,
+ )
+ return list(tables)
- def delete_dataset(self, project_id: str, dataset_id: str,
delete_contents: bool = False) -> None:
+ @GoogleBaseHook.fallback_to_default_project_id
+ def delete_dataset(
+ self,
+ dataset_id: str,
+ project_id: Optional[str] = None,
+ delete_contents: bool = False,
+ retry: Retry = DEFAULT_RETRY,
+ ) -> None:
"""
Delete a dataset of Big query in your project.
:param project_id: The name of the project where we have the dataset .
:type project_id: str
:param dataset_id: The dataset to be delete.
:type dataset_id: str
- :param delete_contents: [Optional] Whether to force the deletion even
if the dataset is not empty.
- Will delete all tables (if any) in the dataset if set to True.
- Will raise HttpError 400: "{dataset_id} is still in use" if set to
False and dataset is not empty.
- The default value is False.
+ :param delete_contents: If True, delete all the tables in the dataset.
If
+ False and the dataset contains tables, the request will fail.
Review comment:
```suggestion
If False and the dataset contains tables, the request will fail.
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]