Struct snowflake_api::SnowflakeApi
source · pub struct SnowflakeApi { /* private fields */ }
Expand description
Snowflake API, keeps connection pool and manages session for you
Implementations§
source§impl SnowflakeApi
impl SnowflakeApi
sourcepub fn new(
connection: Arc<Connection>,
session: Session,
account_identifier: String
) -> Self
pub fn new( connection: Arc<Connection>, session: Session, account_identifier: String ) -> Self
Create a new SnowflakeApi
object with an existing connection and session.
sourcepub fn with_password_auth(
account_identifier: &str,
warehouse: Option<&str>,
database: Option<&str>,
schema: Option<&str>,
username: &str,
role: Option<&str>,
password: &str
) -> Result<Self, SnowflakeApiError>
pub fn with_password_auth( account_identifier: &str, warehouse: Option<&str>, database: Option<&str>, schema: Option<&str>, username: &str, role: Option<&str>, password: &str ) -> Result<Self, SnowflakeApiError>
Initialize object with password auth. Authentication happens on the first request.
sourcepub fn with_certificate_auth(
account_identifier: &str,
warehouse: Option<&str>,
database: Option<&str>,
schema: Option<&str>,
username: &str,
role: Option<&str>,
private_key_pem: &str
) -> Result<Self, SnowflakeApiError>
pub fn with_certificate_auth( account_identifier: &str, warehouse: Option<&str>, database: Option<&str>, schema: Option<&str>, username: &str, role: Option<&str>, private_key_pem: &str ) -> Result<Self, SnowflakeApiError>
Initialize object with private certificate auth. Authentication happens on the first request.
pub fn from_env() -> Result<Self, SnowflakeApiError>
sourcepub async fn close_session(&mut self) -> Result<(), SnowflakeApiError>
pub async fn close_session(&mut self) -> Result<(), SnowflakeApiError>
Closes the current session, this is necessary to clean up temporary objects (tables, functions, etc) which are Snowflake session dependent. If another request is made the new session will be initiated.
sourcepub async fn exec(&self, sql: &str) -> Result<QueryResult, SnowflakeApiError>
pub async fn exec(&self, sql: &str) -> Result<QueryResult, SnowflakeApiError>
Execute a single query against API. If statement is PUT, then file will be uploaded to the Snowflake-managed storage
sourcepub async fn exec_raw(
&self,
sql: &str
) -> Result<RawQueryResult, SnowflakeApiError>
pub async fn exec_raw( &self, sql: &str ) -> Result<RawQueryResult, SnowflakeApiError>
Executes a single query against API. If statement is PUT, then file will be uploaded to the Snowflake-managed storage Returns raw bytes in the Arrow response
sourcepub async fn exec_response(
&mut self,
sql: &str
) -> Result<ExecResponse, SnowflakeApiError>
pub async fn exec_response( &mut self, sql: &str ) -> Result<ExecResponse, SnowflakeApiError>
Useful for debugging to get the straight query response
Auto Trait Implementations§
impl !Freeze for SnowflakeApi
impl !RefUnwindSafe for SnowflakeApi
impl Send for SnowflakeApi
impl Sync for SnowflakeApi
impl Unpin for SnowflakeApi
impl !UnwindSafe for SnowflakeApi
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
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>
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>
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