sqlload_python_host/host/main/
table_stream.rs1use pyo3::{Bound, PyAny};
4use sqlload::python_sources::models::TableRead;
5use sqlload::python_sources::types::BatchStream;
6
7use crate::crossing::main::crossing_options::crossing_options;
8use crate::crossing::main::table_batches::table_batches;
9use crate::host::_helpers::api_version::api_version_problem;
10use crate::host::_helpers::read_context::read_context;
11use crate::host::models::PythonBatches;
12
13pub fn table_stream(
15 iterable: &Bound<'_, PyAny>,
16 snapshot: Option<&Bound<'_, PyAny>>,
17 request: &TableRead,
18) -> Result<Box<dyn BatchStream>, String> {
19 if let Some(problem) = api_version_problem() {
20 return Err(problem);
21 }
22 let batches = table_batches(
23 iterable,
24 snapshot,
25 crossing_options(),
26 read_context(request),
27 );
28 Ok(Box::new(PythonBatches(batches)))
29}