Ibis supports datafusion as one of our backends, and we make use of datafusion-python in service of that.
One of the thornier issues we face right is that Datafusion returns Exception as the exception type when a table isn't found.
The exception message is more specific, but on the Python side, it is generally not a good move to catch a bare Exception -- and we're in the position of having to catch it, then parse the exception message, then continue as appropriate.
[ins] In [5]: from datafusion import SessionContext
[ins] In [6]: c = SessionContext()
[ins] In [7]: c.table("notatable")
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
Cell In[7], line 1
----> 1 c.table("notatable")
Exception: DataFusion error: Plan("No table named 'notatable'")
conversely, attempting to look at a catalog that doesn't exist:
[ins] In [9]: c.catalog("nope")
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[9], line 1
----> 1 c.catalog("nope")
KeyError: "Catalog with name nope doesn't exist."
That's much nicer.
Describe the solution you'd like
Either a datafusion-specific error message, or raise a KeyError (or some other more specific error type.
Describe alternatives you've considered
Catching and parsing, as described above, but it's suboptimal.
Thanks!
Ibis supports datafusion as one of our backends, and we make use of
datafusion-pythonin service of that.One of the thornier issues we face right is that Datafusion returns
Exceptionas the exception type when a table isn't found.The exception message is more specific, but on the Python side, it is generally not a good move to catch a bare
Exception-- and we're in the position of having to catch it, then parse the exception message, then continue as appropriate.conversely, attempting to look at a
catalogthat doesn't exist:That's much nicer.
Describe the solution you'd like
Either a datafusion-specific error message, or raise a
KeyError(or some other more specific error type.Describe alternatives you've considered
Catching and parsing, as described above, but it's suboptimal.
Thanks!