-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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(dataset): fetch metadata on dataset creation may raise broad exceptions #11973
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11973 +/- ##
==========================================
- Coverage 66.26% 60.29% -5.98%
==========================================
Files 941 897 -44
Lines 45715 43912 -1803
Branches 4395 3889 -506
==========================================
- Hits 30293 26475 -3818
- Misses 15287 17437 +2150
+ Partials 135 0 -135
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels pretty harsh to catch Exception
, I wonder if there is some slightly more specific exception (or small set of exceptions) that could be used to catch the majority of these. Another option could be adding db specific exceptions to the db engine spec and then checking for those. Something like
def get_dbapi_exceptions(): Tuple[Exception, ...]:
from pydruid import CustomPydryidException
return (CustomPydryidException, )
I really don't like introducing broad exceptions, but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I'm taking a look at pydruid and trying to repro the problem and see what needs to be done to support BLOBs.
I thought SQLAlchemy should have the mechanism to catch all DB-API exceptions. Here is the SQLAlchemy wrapping of the Either |
True, I was following the logic directly on pydruid: https://github.com/druid-io/pydruid/blob/master/pydruid/db/exceptions.py#L37 That ends up on |
FIY, I fixed the BLOB issuse in pydruid here: druid-io/pydruid#244 |
Thats awesome @betodealmeida I think this approach here still makes sense since other drivers may raise on unsupported types. I'll double check if the exception is narrowed by SQLAlchemy or if we have to content with a broad exception |
@john-bodley unfortunately these exceptions from sqlalchemy dialects (at SQL compile) do not raise any SQLAlchemy exception and SQLAlchemy does not wrap these up. Used
The output:
So it seems that we are bound to catching whatever exceptions the dialects may raise |
SUMMARY
fetch_metadata
may raise broad exceptions from database drivers, the try/catch block was too narrowExample pydruid can raise when a column type is not supported:
ADDITIONAL INFORMATION