Skip to content

Conversation

@KamranImaaz
Copy link
Contributor

Fixes #60687

@KamranImaaz KamranImaaz requested a review from shahar1 as a code owner January 27, 2026 14:26
@boring-cyborg boring-cyborg bot added area:providers provider:google Google (including GCP) related issues labels Jan 27, 2026
@KamranImaaz
Copy link
Contributor Author

@shahar1 due to a small mistake i accidentally pushed the all commits and got auto assigned reviewers. Sorry for that.

Copy link
Contributor

@shahar1 shahar1 left a comment

Choose a reason for hiding this comment

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

Not bad!
Please fix according to the comments.

@shahar1 shahar1 changed the title remove operators redundant exception handling Optimize exception handling in bigtable operator and hook Jan 27, 2026
@shahar1 shahar1 changed the title Optimize exception handling in bigtable operator and hook Optimize exception handling in GCP bigtable operator and hook Jan 27, 2026
@KamranImaaz
Copy link
Contributor Author

And Also Shahar this we are using everywhere in the operator instead of that we can use instance.exists() in one line in hooks right??

        instance = hook.get_instance(project_id=self.project_id, instance_id=self.instance_id)
        if not instance:
            raise AirflowException(f"Dependency: instance '{self.instance_id}' does not exist.")

@shahar1
Copy link
Contributor

shahar1 commented Jan 27, 2026

instance = hook.get_instance(project_id=self.project_id, instance_id=self.instance_id)

You may encapsulate it in the hook where applicable

@KamranImaaz
Copy link
Contributor Author

Okay Sure

@KamranImaaz
Copy link
Contributor Author

I have updated the code according to your comments. Please have a view.

@KamranImaaz KamranImaaz requested a review from shahar1 January 28, 2026 20:51
@KamranImaaz
Copy link
Contributor Author

@shahar1 all the CI checks have passed. your approval would be great here

Copy link
Contributor

@shahar1 shahar1 left a comment

Choose a reason for hiding this comment

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

Looks much better!!!
One last thing to do is to update all docstrings of the operators and hooks according to the changes (for example, "Raises google.api_core.exceptions.NotFound" is not relevant anymore for the modified operators)

@KamranImaaz
Copy link
Contributor Author

Thanks Shahar for your review.

@KamranImaaz
Copy link
Contributor Author

KamranImaaz commented Jan 31, 2026

I created an issue for that yesterday inorder to get your approval before opening a PR. Please have a look #61269

@shahar1
Copy link
Contributor

shahar1 commented Jan 31, 2026

I created an issue for that yesterday inorder to get your approval before opening a PR. Please have a look #61269

I wasn't talking about the documentation in bigtable.rst (which indeed should be updated), but the docstring which is part of the method.
Take a look at: https://github.com/KamranImaaz/apache.airflow/blob/79fb50b12d738f75f25f29717b92a16b75cb22dc/providers/google/src/airflow/providers/google/cloud/hooks/bigtable.py#L245

After your changes this won't be true anymore (same goes for strings in the other methods).
I hope that it's clearer now.

@KamranImaaz
Copy link
Contributor Author

Oh Okay. I misunderstood it. Now I get it. I will update it

@KamranImaaz
Copy link
Contributor Author

KamranImaaz commented Jan 31, 2026

BTW, I already created a branch and was working on it for #61269 seems it already got assigned. Never mind. Let the other person do the work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove redundant try/except blocks in airflow/providers/google/cloud/operators/bigtable.py

2 participants