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

High-level SQL client that wraps Kinetica with result parsing.

SqlClient executes SQL through Kinetica’s /execute/sql endpoint and returns SqlResults, with helpers for paging through large result sets.

Example

Implementations

Source

pub fn new(kinetica: Arc<Kinetica>) -> Self

Create a new SqlClient wrapping a Kinetica instance

Source

pub fn with_defaults( kinetica: Arc<Kinetica>, encoding: &str, limit: i64, ) -> Self

Create a SqlClient with custom defaults

Source

pub fn kinetica(&self) -> &Arc<Kinetica>

Get a reference to the underlying Kinetica client

Source

pub async fn execute(&self, sql: &str) -> SqlOpResult<SqlResult>

Execute a raw SQL string

Source

pub async fn execute_paged( &self, sql: &str, offset: i64, limit: i64, ) -> SqlOpResult<SqlResult>

Execute a raw SQL string with custom limit and offset

Source

pub async fn execute_with_options( &self, sql: &str, offset: i64, limit: i64, options: Option<HashMap<String, String>>, ) -> SqlOpResult<SqlResult>

Execute SQL with full control over options

Source

pub async fn fetch_next_page( &self, paging_table: &str, offset: i64, limit: i64, ) -> SqlOpResult<SqlResult>

Fetch the next page of results using a paging table

When a query returns has_more_records = true, Kinetica creates a temporary paging table containing the full result set. Use this method to fetch subsequent pages from that paging table.

  • paging_table - The paging table name from SqlResult::paging_table()
  • offset - The offset within the paging table to start fetching from
  • limit - The maximum number of records to fetch
Source

pub async fn execute_all( &self, sql: &str, page_size: i64, ) -> SqlOpResult<SqlResult>

Execute a query and iterate through all pages automatically

This method handles pagination transparently, fetching all pages from the paging table and returning an iterator over all results.

Warning: This loads all results into memory. For very large result sets, consider using execute_paged and fetch_next_page to process results in batches.

  • sql - The SQL query to execute
  • page_size - The number of records to fetch per page
Source

pub async fn execute_paginated<F>( &self, sql: &str, page_size: i64, callback: F, ) ->SqlOpResult<PaginationStats>

Execute a query and process results page by page with a callback

This is the most memory-efficient way to process large result sets, as it only loads one page at a time.

  • sql - The SQL query to execute
  • page_size - The number of records to fetch per page
  • callback - A function called for each page of results

Trait Implementations

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more