Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bigquery.py): pass correct project_id to triggerer #35200

Merged
merged 16 commits into from
Dec 17, 2023
Merged
Changes from 3 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
3 changes: 3 additions & 0 deletions airflow/providers/google/cloud/operators/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,8 @@ def execute(self, context: Any):
impersonation_chain=self.impersonation_chain,
)
self.hook = hook
if self.project_id is None:
self.project_id = hook.project_id
Comment on lines +2795 to +2796
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be consistent with L2852, although either is fine

Suggested change
if self.project_id is None:
self.project_id = hook.project_id
self.project_id = self.project_id or self.hook.project_id

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove all references that do project_id = self.project_id or self.hook.project_id since this is what caused the whole issue in the first place, IMO.

The style I'm following is the one used for most hooks assignments when mutating the object on execution


self.job_id = hook.generate_job_id(
job_id=self.job_id,
Expand Down Expand Up @@ -2848,6 +2850,7 @@ def execute(self, context: Any):
BigQueryTableLink.persist(**persist_kwargs)
self.job_id = job.job_id
project_id = self.project_id or self.hook.project_id

mokshasoul marked this conversation as resolved.
Show resolved Hide resolved
if project_id:
job_id_path = convert_job_id(
job_id=self.job_id, project_id=project_id, location=self.location # type: ignore[arg-type]
Expand Down
Loading