Repository navigation
Description
Apache Airflow Provider(s)
Versions of Apache Airflow Providers
No response
Apache Airflow version
3.2.0
Operating System
Windows(Local Development)
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
What happened
In The Operator Bigtable.py contains several try/except block that are not required and not expected in Operator Level as it Should be handled at Hook Level.
Moreover The Exceptions raised at the Operator level are already Handled at the Hook Level. So what's the point of duplicating it in Operator Level. Let me take an example here
Bigtable.py operator file contains one class BigtableDeleteInstanceOperator which has a method
` def execute(self, context: Context) -> None:
hook = BigtableHook(
gcp_conn_id=self.gcp_conn_id,
impersonation_chain=self.impersonation_chain,
)
try:
hook.delete_instance(project_id=self.project_id, instance_id=self.instance_id)
except google.api_core.exceptions.NotFound:
self.log.info(
"The instance '%s' does not exist in project '%s'. Consider it as deleted",
self.instance_id,
self.project_id,
)
except google.api_core.exceptions.GoogleAPICallError as e:
self.log.error("An error occurred. Exiting.")
raise e`
It raises exception when the instance does not exists which is already handled at the Hook level see below
` @GoogleBaseHook.fallback_to_default_project_id
def delete_instance(self, instance_id: str, project_id: str) -> None:
instance = self.get_instance(instance_id=instance_id, project_id=project_id)
if instance:
instance.delete()
else:
self.log.warning(
"The instance '%s' does not exist in project '%s'. Exiting", instance_id, project_id
)`
Like wise the whole Bigquery.py has lot's of not necessary try/except blocks.
What you think should happen instead
No response
How to reproduce
I will raise a PR for the above mentioned code first and in the next PR I will fix the whole Bigtable.py file.
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
KamranImaaz commentedon Jan 17, 2026
If it's fine I will raise a PR to fix the above code and in the next PR I will fix the whole
Bigtable.pyfile. waiting for your approval :)KamranImaaz commentedon Jan 17, 2026
@shahar1 can you pls look into this once
shahar1 commentedon Jan 17, 2026
Seems like a good catch - we've carried these duplications for over 7 years, and we could definitely optimize them.
I'll assign you to this task. Important notes before implementing
KamranImaaz commentedon Jan 17, 2026
Sure I'll follow this
KamranImaaz commentedon Jan 17, 2026
Can you pls assign it to me just in case to avoid duplicacy. I will start working on this
shahar1 commentedon Jan 17, 2026
I thought I did, my bad - you're officially assigned :)
KamranImaaz commentedon Jan 17, 2026
Thanks I'll start working
shahar1 commentedon Jan 18, 2026
The issue seems to be applied only on "Delete Instance Operator", not the "Delete Table"
Shrivadhu commentedon Jan 19, 2026
Hi @shahar1, @KamranImaaz 👋
I noticed this issue is currently assigned, but I’d love to contribute as well.
I can work specifically on:
BigtableDeleteTableOperator, orPlease let me know if that would be helpful, and I’ll proceed accordingly.
Thanks!
shahar1 commentedon Jan 19, 2026
Hey there! I appreciate your will to contribute - but I think that currently there's no need for more people to work on this issue.
Please explore other unassigned issues labeled as good first issue, or such issues that have been stale for a while - you may tag me and I'll happily assign you.
SeifEddineMezned commentedon Jan 20, 2026
Hi,I opened a PR to address this issue: #60825
It removes redundant try/except blocks in Bigtable operators while keeping behavior-changing handlers intact.
KamranImaaz commentedon Jan 20, 2026
Please read the issue and comments thoroughly. As this issue is already addressed. Please look for other issues.
shahar1 commentedon Jan 20, 2026
Please read my comment in the PR and my comment below.
Please let me handle the situation.
As long as you stay active, I'll give you the opportunity to take care of all
try..exceptin this file.For new contributors who consider to step in - this issue is currently assigned and there are 106 other unassigned issues labeled as good first issue. Please do not create PRs for this issue and try them instead, that is unless either @KamranImaaz agrees for that, or he becomes inactive for at least a week. Thank you.
shahar1 commentedon Jan 24, 2026
@KamranImaaz Would you like to handle the other redundant
try...exceptexpressions in this file?KamranImaaz commentedon Jan 24, 2026
Yes I would like to work on it
KamranImaaz commentedon Jan 24, 2026
I will raise a PR for it soon.
Tanmay-Ts commentedon Jan 29, 2026
I confirm this issue
Tanmay-Ts commentedon Jan 29, 2026
Thanks for the update and the linked PR.
I’m happy to help with any follow-up or additional cleanup if needed. Please let me know.