Preparing Snowflake for integration.Documentation Index
Fetch the complete documentation index at: https://docs2.zenskar.com/llms.txt
Use this file to discover all available pages before exploring further.
🐕🦺 Setup guide
In this guide, we will explore how to set up Snowflake for integration with Zenskar. The outcome of this guide will be a SQL script that does the following for integration with Zenskar:- Create a Snowflake role
- Create a Snowflake user
- Create a Snowflake warehouse
- Create a Snowflake database
- Grant the role and user appropriate privileges and access
⚙️ Define identifiers
Define some identifiers to refer to Snowflake objects in the SQL script.In Snowflake SQL statements, in addition to referring to objects by name (see Identifier Requirements), you can also use a string literal, session variable, bind variable, or Snowflake Scripting variable to refer to an object. For example, you can use a session variable that is set to the name of a table in the FROM clause of a SELECT statement.To use an object name specified in a literal or variable, use
IDENTIFIER().
<string_literal>: string identifying the name of the object:
- The string must either be enclosed by single quotes (‘name’) or start with a dollar sign ($name).
- The string literal can be a fully-qualified object name (e.g. ‘db_name.schema_name.object_name’ or $db_name.schema_name.object_name).
Identifiers and placeholders
In the above snippet, the structure of the statement isset IDENTIFIER = 'PLACEHOLDER';. For example, in the statement set zenskar_role = '<zenskar_role>';, zenskar_role is the identifier whereas <zenskar_role> is the placeholder. Replace the placeholder with appropriate values before executing the SQL script.⚙️ Create a role for Zenskar
Create a role for Zenskar in Snowflake. Only a user assigned with thesecurityadmin role can create a new role.
SECURITYADMIN (aka Security Administrator) Role that can manage any object grant globally, as well as create, monitor, and manage users and roles. More specifically, this role:The following script snippet uses the
- Is granted the MANAGE GRANTS security privilege to be able to modify any grant, including revoking it.
- Inherits the privileges of the USERADMIN role via the system role hierarchy (i.e. USERADMIN role is granted to SECURITYADMIN).
securityadmin role privileges to create a role dedicated to Zenskar (identifier($zenskar_role)). Further, the snippet grants the privileges of the sysadmin role to the newly created Zenskar role.
SYSADMIN (aka System Administrator) Role that has privileges to create warehouses and databases (and other objects) in an account. If, as recommended, you create a role hierarchy that ultimately assigns all custom roles to the SYSADMIN role, this role also has the ability to grant privileges on warehouses, databases, and other objects to other roles.
⚙️ Create a user for Zenskar
Create a user dedicated to Zenskar.To facilitate querying immediately after a session is initiated, Snowflake supports specifying a default warehouse for each individual user. The default warehouse for a user is used as the warehouse for all sessions initiated by the user. A default warehouse can be specified when creating or modifying the user, either through the web interface or using CREATE USER/ALTER USER.
⚙️ Grant Zenskar role to Zenskar user
The Zenskar role we configured earlier, must be assigned to the Zenskar user.⚙️ Create a warehouse and a database for Zenskar
Only asysadmin has privileges to create warehouses and databases:
