Skip to main content
pub struct SqlIterator  /* private fields */ 

Iterates over the records an SQL query returns.

The first batch is fetched when the iterator is created. Call SqlIterator::close when done to drop the paging tables; nothing drops them otherwise.

Implementations

Source

pub async fn new(db: Arc<Kinetica>, sql: &str) -> Result<Self, KineticaError>

Runs sql, fetching 10,000 records at a time.

Source

pub async fn with_batch_size( db: Arc<Kinetica>, sql: &str, batch_size: i32, ) -> Result<Self, KineticaError>

Runs sql, fetching batch_size records at a time.

Source

pub async fn with_options( db: Arc<Kinetica>, sql: &str, sql_options: HashMap<String, String>, ) -> Result<Self, KineticaError>

Runs sql with the given SQL options, fetching 10,000 records at a time.

Source

pub async fn with_batch_size_and_options( db: Arc<Kinetica>, sql: &str, batch_size: i32, sql_options: Option<HashMap<String, String>>, ) -> Result<Self, KineticaError>

Runs sql with the given SQL options, fetching batch_size records at a time. A paging_table option is replaced: the iterator pages through a table of its own, and drops it on close.

Source

pub fn set_sql_options(&mut self, sql_options: Option<HashMap<String, String>>)

Replaces the SQL options, keeping this iterator’s paging table. A paging_table option is replaced, as when the iterator is created.

Source

pub fn total_records(&self) -> i64

The number of records the query returns in all.

Source

pub fn has_next(&self) -> bool

Whether another record is to come.

Source

pub async fn next(&mut self) -> Result<GenericRecord, KineticaError>

The next record, fetching the next batch when this one is done. Fails when there are no more.

Source

pub async fn close(&mut self)

Drops the server-side tables the iteration created. A table that cannot be dropped is logged and skipped.