Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions airflow/providers/google/cloud/transfers/bigquery_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"""This module contains Google BigQuery to Google Cloud Storage operator."""
from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Union

from google.cloud.bigquery import ExtractJob

from airflow.models import BaseOperator
from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook, BigQueryJob
from airflow.providers.google.cloud.links.bigquery import BigQueryTableLink
Expand Down Expand Up @@ -125,12 +127,13 @@ def execute(self, context: 'Context'):
labels=self.labels,
return_full_job=True,
)
conf = job["configuration"]["extract"]["sourceTable"]
dataset_id, project_id, table_id = conf["datasetId"], conf["projectId"], conf["tableId"]
BigQueryTableLink.persist(
context=context,
task_instance=self,
dataset_id=dataset_id,
project_id=project_id,
table_id=table_id,
)
table_ref = job.source
if isinstance(table_ref, ExtractJob):
dataset_id, project_id, table_id = table_ref.dataset_id, table_ref.project, table_ref.table_id
BigQueryTableLink.persist(
context=context,
task_instance=self,
dataset_id=dataset_id,
project_id=project_id,
table_id=table_id,
)