snowflake
Module snowflake

ballerinax/snowflake Ballerina library
Clients
snowflake: Client
Represents a Snowflake database client.
Constructor
Initializes the Snowflake Client. The client must be kept open throughout the application lifetime.
init (string account_identifier, string user, string password, Options? options, ConnectionPool? connectionPool)
- account_identifier string - The Snowflake account identifier
- user string - The username of the Snowflake account
- password string - The password of the Snowflake account
- options Options? () - The Snowflake client properties
- connectionPool ConnectionPool? () - The
sql:ConnectionPool
to be used for the connection. If there is noconnectionPool
provided, the global connection pool (shared by all clients) will be used
query
function query(ParameterizedQuery sqlQuery, typedesc<record {}> rowType) returns stream<rowType, Error?>
Executes the query, which may return multiple results. When processing the stream, make sure to consume all fetched data or close the stream.
Parameters
- sqlQuery ParameterizedQuery - The SQL query such as
`SELECT * from Album WHERE name=${albumName}`
- rowType typedesc<record {}> (default <>) - The
typedesc
of the record to which the result needs to be returned
queryRow
function queryRow(ParameterizedQuery sqlQuery, typedesc<anydata> returnType) returns returnType|Error
Executes the query, which is expected to return at most one row of the result.
If the query does not return any results, sql:NoRowsError
is returned.
Parameters
- sqlQuery ParameterizedQuery - The SQL query such as
`SELECT * from Album WHERE name=${albumName}`
- returnType typedesc<anydata> (default <>) - The
typedesc
of the record to which the result needs to be returned. It can be a basic type if the query result contains only one column
Return Type
- returnType|Error - Result in the
returnType
type or ansql:Error
execute
function execute(ParameterizedQuery sqlQuery) returns ExecutionResult|Error
Executes the SQL query. Only the metadata of the execution is returned (not the results from the query).
Parameters
- sqlQuery ParameterizedQuery - The SQL query such as
`DELETE FROM Album WHERE artist=${artistName}`
Return Type
- ExecutionResult|Error - Metadata of the query execution as an
sql:ExecutionResult
or ansql:Error
batchExecute
function batchExecute(ParameterizedQuery[] sqlQueries) returns ExecutionResult[]|Error
Executes the SQL query with multiple sets of parameters in a batch.
Only the metadata of the execution is returned (not results from the query).
If one of the commands in the batch fails, this will return an sql:BatchExecuteError
. However, the driver may
or may not continue to process the remaining commands in the batch after a failure.
Parameters
- sqlQueries ParameterizedQuery[] - The SQL query with multiple sets of parameters
Return Type
- ExecutionResult[]|Error - Metadata of the query execution as an
sql:ExecutionResult[]
or ansql:Error
call
function call(ParameterizedCallQuery sqlQuery, typedesc<record {}>[] rowTypes) returns ProcedureCallResult|Error
Executes a SQL query, which calls a stored procedure. This may or may not return results.
Parameters
- sqlQuery ParameterizedCallQuery - The SQL query such as
`CALL sp_GetAlbums();`
- rowTypes typedesc<record {}>[] (default []) -
typedesc
array of the records to which the results need to be returned
Return Type
- ProcedureCallResult|Error - Summary of the execution and results are returned in an
sql:ProcedureCallResult
, or ansql:Error
close
function close() returns Error?
Closes the SQL client and shuts down the connection pool.
Return Type
- Error? - Possible error when closing the client
Records
snowflake: Options
An additional set of configurations related to a database connection.
Fields
- datasourceName string?(default ()) - The driver class name to be used to get the connection
- properties map<anydata>?(default ()) - The database properties, which should be applied when getting the connection
Import
import ballerinax/snowflake;
Metadata
Released date: 9 days ago
Version: 2.1.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.11.0
GraalVM compatible: Yes
Pull count
Total: 2554
Current verison: 15
Weekly downloads
Keywords
IT Operations/Cloud Services
Cost/Paid
Contributors
Dependencies