Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Snowflake Client
/// <summary>
/// A client for submitting queries to Snowflake.
/// </summary>
public class SnowflakeClient
{
private readonly string connectionString;
/// <summary>
/// Initializes a new instance of the <see cref="SnowflakeClient"/> class.
/// </summary>
public SnowflakeClient(string connectionString)
{
this.connectionString = connectionString;
}
/// <summary>
/// Executes a sequence of Snowflake statements that are not expected to return a result set.
/// </summary>
public int ExecuteNonQuery(params string[] statements)
{
using (IDbConnection conn = new SnowflakeDbConnection())
{
conn.ConnectionString = this.connectionString;
conn.Open();
IDbCommand cmd = conn.CreateCommand();
int affectedRows = 0;
foreach (string command in statements)
{
cmd.CommandText = command;
affectedRows = cmd.ExecuteNonQuery();
}
return affectedRows;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment