pub trait SyncDbConnection<T, P>: DbConnection<T, P> {
    // Required methods
    fn new(conn: T) -> Self
       where Self: Sized;
    fn get_schema(
        &self,
        table_reference: &TableReference,
    ) -> Result<SchemaRef, Error>;
    fn query_arrow(
        &self,
        sql: &str,
        params: &[P],
        projected_schema: Option<SchemaRef>,
    ) -> Result<SendableRecordBatchStream, GenericError>;
    fn execute(&self, sql: &str, params: &[P]) -> Result<u64, GenericError>;
}

Required Methods§

source

fn new(conn: T) -> Self
where Self: Sized,

source

fn get_schema( &self, table_reference: &TableReference, ) -> Result<SchemaRef, Error>

Get the schema for a table reference.

§Arguments
  • table_reference - The table reference.
§Errors

Returns an error if the schema cannot be retrieved.

source

fn query_arrow( &self, sql: &str, params: &[P], projected_schema: Option<SchemaRef>, ) -> Result<SendableRecordBatchStream, GenericError>

Query the database with the given SQL statement and parameters, returning a Result of SendableRecordBatchStream.

§Arguments
  • sql - The SQL statement.
  • params - The parameters for the SQL statement.
  • projected_schema - The Projected schema for the query.
§Errors

Returns an error if the query fails.

source

fn execute(&self, sql: &str, params: &[P]) -> Result<u64, GenericError>

Execute the given SQL statement with parameters, returning the number of affected rows.

§Arguments
  • sql - The SQL statement.
  • params - The parameters for the SQL statement.
§Errors

Returns an error if the execution fails.

Implementors§