Struct datafusion_python::context::PySessionContext
source · pub struct PySessionContext {
pub ctx: SessionContext,
}Expand description
PySessionContext is able to plan and execute DataFusion plans.
It has a powerful optimizer, a physical planner for local execution, and a
multi-threaded execution engine to perform the execution.
Fields§
§ctx: SessionContextImplementations§
source§impl PySessionContext
impl PySessionContext
pub fn new( config: Option<PySessionConfig>, runtime: Option<PyRuntimeConfig> ) -> PyResult<Self>
sourcepub fn register_object_store(
&mut self,
scheme: &str,
store: &PyAny,
host: Option<&str>
) -> PyResult<()>
pub fn register_object_store( &mut self, scheme: &str, store: &PyAny, host: Option<&str> ) -> PyResult<()>
Register an object store with the given name
pub fn register_listing_table( &mut self, name: &str, path: &str, table_partition_cols: Vec<(String, String)>, file_extension: &str, schema: Option<PyArrowType<Schema>>, file_sort_order: Option<Vec<Vec<PyExpr>>>, py: Python<'_> ) -> PyResult<()>
sourcepub fn sql(&mut self, query: &str, py: Python<'_>) -> PyResult<PyDataFrame>
pub fn sql(&mut self, query: &str, py: Python<'_>) -> PyResult<PyDataFrame>
Returns a PyDataFrame whose plan corresponds to the SQL statement.
pub fn sql_with_options( &mut self, query: &str, options: Option<PySQLOptions>, py: Python<'_> ) -> PyResult<PyDataFrame>
pub fn create_dataframe( &mut self, partitions: PyArrowType<Vec<Vec<RecordBatch>>>, name: Option<&str>, schema: Option<PyArrowType<Schema>>, py: Python<'_> ) -> PyResult<PyDataFrame>
sourcepub fn create_dataframe_from_logical_plan(
&mut self,
plan: PyLogicalPlan
) -> PyDataFrame
pub fn create_dataframe_from_logical_plan( &mut self, plan: PyLogicalPlan ) -> PyDataFrame
Create a DataFrame from an existing logical plan
sourcepub fn from_pylist(
&mut self,
data: PyObject,
name: Option<&str>,
_py: Python<'_>
) -> PyResult<PyDataFrame>
pub fn from_pylist( &mut self, data: PyObject, name: Option<&str>, _py: Python<'_> ) -> PyResult<PyDataFrame>
Construct datafusion dataframe from Python list
sourcepub fn from_pydict(
&mut self,
data: PyObject,
name: Option<&str>,
_py: Python<'_>
) -> PyResult<PyDataFrame>
pub fn from_pydict( &mut self, data: PyObject, name: Option<&str>, _py: Python<'_> ) -> PyResult<PyDataFrame>
Construct datafusion dataframe from Python dictionary
sourcepub fn from_arrow_table(
&mut self,
data: PyObject,
name: Option<&str>,
_py: Python<'_>
) -> PyResult<PyDataFrame>
pub fn from_arrow_table( &mut self, data: PyObject, name: Option<&str>, _py: Python<'_> ) -> PyResult<PyDataFrame>
Construct datafusion dataframe from Arrow Table
sourcepub fn from_pandas(
&mut self,
data: PyObject,
name: Option<&str>,
_py: Python<'_>
) -> PyResult<PyDataFrame>
pub fn from_pandas( &mut self, data: PyObject, name: Option<&str>, _py: Python<'_> ) -> PyResult<PyDataFrame>
Construct datafusion dataframe from pandas
sourcepub fn from_polars(
&mut self,
data: PyObject,
name: Option<&str>,
_py: Python<'_>
) -> PyResult<PyDataFrame>
pub fn from_polars( &mut self, data: PyObject, name: Option<&str>, _py: Python<'_> ) -> PyResult<PyDataFrame>
Construct datafusion dataframe from polars
pub fn register_table(&mut self, name: &str, table: &PyTable) -> PyResult<()>
pub fn deregister_table(&mut self, name: &str) -> PyResult<()>
pub fn register_record_batches( &mut self, name: &str, partitions: PyArrowType<Vec<Vec<RecordBatch>>> ) -> PyResult<()>
pub fn register_parquet( &mut self, name: &str, path: &str, table_partition_cols: Vec<(String, String)>, parquet_pruning: bool, file_extension: &str, skip_metadata: bool, schema: Option<PyArrowType<Schema>>, file_sort_order: Option<Vec<Vec<PyExpr>>>, py: Python<'_> ) -> PyResult<()>
pub fn register_csv( &mut self, name: &str, path: PathBuf, schema: Option<PyArrowType<Schema>>, has_header: bool, delimiter: &str, schema_infer_max_records: usize, file_extension: &str, file_compression_type: Option<String>, py: Python<'_> ) -> PyResult<()>
pub fn register_json( &mut self, name: &str, path: PathBuf, schema: Option<PyArrowType<Schema>>, schema_infer_max_records: usize, file_extension: &str, table_partition_cols: Vec<(String, String)>, file_compression_type: Option<String>, py: Python<'_> ) -> PyResult<()>
pub fn register_avro( &mut self, name: &str, path: PathBuf, schema: Option<PyArrowType<Schema>>, file_extension: &str, table_partition_cols: Vec<(String, String)>, py: Python<'_> ) -> PyResult<()>
pub fn register_dataset( &self, name: &str, dataset: &PyAny, py: Python<'_> ) -> PyResult<()>
pub fn register_udf(&mut self, udf: PyScalarUDF) -> PyResult<()>
pub fn register_udaf(&mut self, udaf: PyAggregateUDF) -> PyResult<()>
pub fn catalog(&self, name: &str) -> PyResult<PyCatalog>
pub fn tables(&self) -> HashSet<String>
pub fn table(&self, name: &str, py: Python<'_>) -> PyResult<PyDataFrame>
pub fn table_exist(&self, name: &str) -> PyResult<bool>
pub fn empty_table(&self) -> PyResult<PyDataFrame>
pub fn session_id(&self) -> String
pub fn read_json( &mut self, path: PathBuf, schema: Option<PyArrowType<Schema>>, schema_infer_max_records: usize, file_extension: &str, table_partition_cols: Vec<(String, String)>, file_compression_type: Option<String>, py: Python<'_> ) -> PyResult<PyDataFrame>
pub fn read_csv( &self, path: PathBuf, schema: Option<PyArrowType<Schema>>, has_header: bool, delimiter: &str, schema_infer_max_records: usize, file_extension: &str, table_partition_cols: Vec<(String, String)>, file_compression_type: Option<String>, py: Python<'_> ) -> PyResult<PyDataFrame>
pub fn read_parquet( &self, path: &str, table_partition_cols: Vec<(String, String)>, parquet_pruning: bool, file_extension: &str, skip_metadata: bool, schema: Option<PyArrowType<Schema>>, file_sort_order: Option<Vec<Vec<PyExpr>>>, py: Python<'_> ) -> PyResult<PyDataFrame>
pub fn read_avro( &self, path: &str, schema: Option<PyArrowType<Schema>>, table_partition_cols: Vec<(String, String)>, file_extension: &str, py: Python<'_> ) -> PyResult<PyDataFrame>
pub fn read_table(&self, table: &PyTable) -> PyResult<PyDataFrame>
Trait Implementations§
source§impl Clone for PySessionContext
impl Clone for PySessionContext
source§fn clone(&self) -> PySessionContext
fn clone(&self) -> PySessionContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl From<PySessionContext> for SessionContext
impl From<PySessionContext> for SessionContext
source§fn from(ctx: PySessionContext) -> SessionContext
fn from(ctx: PySessionContext) -> SessionContext
Converts to this type from the input type.
source§impl From<SessionContext> for PySessionContext
impl From<SessionContext> for PySessionContext
source§fn from(ctx: SessionContext) -> PySessionContext
fn from(ctx: SessionContext) -> PySessionContext
Converts to this type from the input type.
source§impl PyClass for PySessionContext
impl PyClass for PySessionContext
source§impl PyClassImpl for PySessionContext
impl PyClassImpl for PySessionContext
source§const IS_BASETYPE: bool = true
const IS_BASETYPE: bool = true
#[pyclass(subclass)]
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
§type ThreadChecker = SendablePyClass<PySessionContext>
type ThreadChecker = SendablePyClass<PySessionContext>
This handles following two situations: Read more
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<PySessionContext> for PyClassImplCollector<PySessionContext>
impl PyClassNewTextSignature<PySessionContext> for PyClassImplCollector<PySessionContext>
fn new_text_signature(self) -> Option<&'static str>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PySessionContext
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PySessionContext
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PySessionContext
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PySessionContext
source§impl PyMethods<PySessionContext> for PyClassImplCollector<PySessionContext>
impl PyMethods<PySessionContext> for PyClassImplCollector<PySessionContext>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for PySessionContext
impl PyTypeInfo for PySessionContext
§type AsRefTarget = PyCell<PySessionContext>
type AsRefTarget = PyCell<PySessionContext>
Utility type to make Py::as_ref work.
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
Returns the safe abstraction over the type object.
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
Checks if
object is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
Checks if
object is an instance of this type.Auto Trait Implementations§
impl Freeze for PySessionContext
impl !RefUnwindSafe for PySessionContext
impl Send for PySessionContext
impl Sync for PySessionContext
impl Unpin for PySessionContext
impl !UnwindSafe for PySessionContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<'a, T> FromPyObject<'a> for T
impl<'a, T> FromPyObject<'a> for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more