Skip to content

Commit

Permalink
Raise an error if method is not implemented when it is expected
Browse files Browse the repository at this point in the history
  • Loading branch information
timsaucer committed Nov 12, 2024
1 parent 64dcbd3 commit e31e478
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use object_store::ObjectStore;
use url::Url;
use uuid::Uuid;

use pyo3::exceptions::{PyKeyError, PyTypeError, PyValueError};
use pyo3::exceptions::{PyKeyError, PyNotImplementedError, PyTypeError, PyValueError};
use pyo3::prelude::*;

use crate::catalog::{PyCatalog, PyTable};
Expand Down Expand Up @@ -582,8 +582,13 @@ impl PySessionContext {
let provider: ForeignTableProvider = provider.into();

let _ = self.ctx.register_table(name, Arc::new(provider))?;

Ok(())
} else {
Err(PyNotImplementedError::new_err(
"__datafusion_table_provider__ does not exist on Table Provider object.",
))
}
Ok(())
}

pub fn register_record_batches(
Expand Down

0 comments on commit e31e478

Please sign in to comment.