Snowflake

This guide provides step-by-step instructions for setting up the sample jobs located in the Snowflake example folder.

Please refer to this page for more information: Tutorial: Execute Snowflake statements via Rest API.

Prerequisites

Before continuing with this guide, ensure you have completed the following prerequisites:

  • Install the Snoweaver CLI.

  • If you have just installed Snoweaver, ensure you have launched the admin console to initialize the Admin API.

Preparation

  1. Donwlaod or Clone the Quickstart Repository to your local machine.

  2. Navigate to the directory examples/snowflake

  3. Open the setup.sh file in a text editor to update the following variables, or alternatively, set their values using environment variables:

    • CONN Specify the Snowsql connection for the Snowflake account, ensuring it points to database: SNOWEAVER and schema: LEARN_DEV. Verify that the role associated with this connection has the required privileges to execute the commands in setup.sql. Ideally, use the AccountAdmin role or an equivalent role in a sandbox environment.

    • USER The Snowflake user defined in the Snowsql connection.

    • SNFLK_ORG The Snowflake organization to connect to, specified in lowercase.

    • SNFLK_ACCOUNT The Snowflake account to connect to, specified in lowercase.

    • SNFLK_PUBLIC_KEY The public key for the test account to be created.

    • SNFLK_PRIVATE_KEY The private key for the test account to be created. You can specify the private key as follows:

      SNFLK_PRIVATE_KEY="
      -----BEGIN PRIVATE KEY-----
      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      -----END PRIVATE KEY-----
      "
      

Set up the sample project

  1. On your client machine, open a command-line terminal (Linux, macOS) or Git Bash (Windows) and navigate to the same directory.

  2. Execute the following command to set up the example project:

    bash setup.sh
    

    Note

    If the LEARN_DEV project already exists, all its resources will be deleted, with the exception of the DATA stage and the RESULTS table.

    To retain your data, you can remove the -d flag from the ‘sw import all -c ${CONN} -d’’ command in the setup.sh script.

    Alternatively, use the Snoweaver CLI to create a backup of the project’s contents.

  3. After the execution completes, you can access the sample jobs in the LEARN_DEV project.

Execute Snowflake statements via Rest API

Sample Jobs:

  • snflk_local_exec_stmt

  • snflk_local_exec_jinja_output

Further Reading: