feluelle commented on a change in pull request #6151: [AIRFLOW-5522] BQ list 
dataset tables operator
URL: https://github.com/apache/airflow/pull/6151#discussion_r326870004
 
 

 ##########
 File path: airflow/gcp/hooks/bigquery.py
 ##########
 @@ -1430,6 +1430,39 @@ def cancel_query(self) -> None:
                               self.running_job_id)
                 time.sleep(5)
 
+    def get_dataset_tables(self, dataset_id: str, project_id: Optional[str] = 
None,
+                           max_results: Optional[int] = None,
+                           page_token: Optional[str] = None) -> Dict[str, 
Union[str, int, List]]:
+        """
+        Get the list of tables for a given dataset.
+        see 
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/list
+
+        :param dataset_id: the dataset ID of the requested dataset.
+        :type dataset_id: str
+        :param project_id: (Optional) the project of the requested dataset. If 
None,
+            self.project_id will be used.
+        :type project_id: str
+        :param max_results: (Optional) the maximum number of tables to return.
+        :type max_results: int
+        :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.
+        """
+        optional_params = {}
+        if max_results:
+            optional_params['maxResults'] = max_results
+        if page_token:
+            optional_params['pageToken'] = page_token
+
+        dataset_project_id = project_id if project_id else self.project_id
 
 Review comment:
   ```suggestion
           dataset_project_id = project_id or self.project_id
   ```
   See: https://docs.python.org/3/library/stdtypes.html#truth-value-testing

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to