Taragolis commented on code in PR #38707:
URL: https://github.com/apache/airflow/pull/38707#discussion_r1561222877
##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -111,6 +112,15 @@ def fetch_one_handler(cursor) -> list[tuple] | None:
return None
+@contextmanager
+def suppress_and_warn(*exceptions: type[BaseException]):
+ """Context manager that suppresses the given exceptions and logs a warning
message."""
+ try:
+ yield
+ except exceptions as e:
+ warnings.warn(f"Exception suppressed: {e}\n{traceback.format_exc()}",
category=UserWarning)
+
+
Review Comment:
>Ok. then what we should do if it is used in several providers - since we
have no common.util - do you propose to copy it simply ? Less DRY, less
coupling, more copy&paste. Or any other idea?
My proposal do not mix-in new feature changes in two different provider in
the same time.
- We do not know is it become useful into the other provider and would be
- We do not know side effect (in general, not in this case)
So if the purpose it to do into the single one/two provider, keep it in it
do not need to put it into the `common.sql` it is not **common** and it is not
**sql**
No required to replace one potential `common.utils` package by the other
`common.sql`, no additional headache to release manager, because it required to
bump version of dependency, and until last time it might be unknow which next
version would be patch, minor and major
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]