turbaszek commented on a change in pull request #10773:
URL: https://github.com/apache/airflow/pull/10773#discussion_r484429681
##########
File path: airflow/providers/google/cloud/transfers/bigquery_to_gcs.py
##########
@@ -139,14 +141,32 @@ def execute(self, context):
location=self.location,
impersonation_chain=self.impersonation_chain,
)
- conn = hook.get_conn()
- cursor = conn.cursor()
- cursor.run_extract(
- source_project_dataset_table=self.source_project_dataset_table,
- destination_cloud_storage_uris=self.destination_cloud_storage_uris,
- compression=self.compression,
- export_format=self.export_format,
- field_delimiter=self.field_delimiter,
- print_header=self.print_header,
- labels=self.labels,
+
+ table = Table(
+
table_ref=TableReference.from_string(self.source_project_dataset_table,
hook.project_id)
)
+
+ configuration: Dict[str, Any] = {
+ 'extract': {
+ 'sourceTable': {
+ 'projectId': table.project,
+ 'datasetId': table.dataset_id,
+ 'tableId': table.table_id,
+ },
Review comment:
We can use one more magic method 😄
```suggestion
'sourceTable': table_ref.to_api_repr(),
```
then we don't have to construct `Table`, having this should be enough:
```py
table_ref=TableReference.from_string(self.source_project_dataset_table,
hook.project_id)
```
and kudos for using `hook.project_id`
----------------------------------------------------------------
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]