kosiew commented on code in PR #1016: URL: https://github.com/apache/datafusion-python/pull/1016#discussion_r1959511859
########## src/dataframe.rs: ########## @@ -50,6 +52,22 @@ use crate::{ expr::{sort_expr::PySortExpr, PyExpr}, }; +#[pyclass(name = "TableProvider", module = "datafusion")] +pub struct PyTableProvider { + provider: Arc<dyn TableProvider>, +} + +impl PyTableProvider { + pub fn new(provider: Arc<dyn TableProvider>) -> Self { + Self { provider } + } + + pub fn as_table(&self) -> PyTable { + let table_provider: Arc<dyn TableProvider> = self.provider.clone(); + PyTable::new(table_provider) + } +} + Review Comment: > a single common PyTableProvider that can be created either via a pycapsule or into_view. Do you mean a constructor that takes a pycapsule argument, then extract provider to use in PyTableProvider::new(provider)? Can I check how I can obtain the provider from `pub struct PyCapsule(PyAny)`? -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org