We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 909b809 commit fe0738aCopy full SHA for fe0738a
2 files changed
python/datafusion/tests/test_context.py
@@ -466,6 +466,13 @@ def test_table_exist(ctx):
466
assert ctx.table_exist("t") is True
467
468
469
+def test_table_not_found(ctx):
470
+ from uuid import uuid4
471
+
472
+ with pytest.raises(KeyError):
473
+ ctx.table(f"not-found-{uuid4()}")
474
475
476
def test_read_json(ctx):
477
path = os.path.dirname(os.path.abspath(__file__))
478
src/context.rs
@@ -765,7 +765,8 @@ impl PySessionContext {
765
}
766
767
pub fn table(&self, name: &str, py: Python) -> PyResult<PyDataFrame> {
768
- let x = wait_for_future(py, self.ctx.table(name)).map_err(DataFusionError::from)?;
+ let x = wait_for_future(py, self.ctx.table(name))
769
+ .map_err(|e| PyKeyError::new_err(e.to_string()))?;
770
Ok(PyDataFrame::new(x))
771
772
0 commit comments