Snowflake

The akenza Snowflake connector enables direct ingestion of device telemetry into the Snowflake Cloud Data Platform for large-scale analytics and cloud-native data warehousing.

The connector uses the Snowflake Snowpipe Streaming APIarrow-up-right to continuously ingest device data with low latency and high throughput (check its high-performance architecturearrow-up-right).

This allows sensor data processed by akenza to be written directly into Snowflake tables without intermediate storage layers.

Setup

Follow the steps below to configure Snowflake for use with the akenza Snowflake connector.

circle-info

Prerequisites: Before configuring the Snowflake connector, make sure you have access to a Snowflake account. If you do not already have a user, you will first need to create one.

Snowflake users can be created by an account administrator. The process is straightforward and can be done throught the Snowsight UI. Please follow the instructions in the Snowflake documentationarrow-up-right. This guide explains how to create and manage users in Snowflake using Snowsight.

Create the database and table

Create a database and a table that will store the incoming device data.

circle-info

The table schema must match the structure of the custom payload defined in the akenza Snowflake output connector configuration. Each field defined in the custom payload must correspond to a column in the target Snowflake table, and the data types must be compatible.

CREATE DATABASE <database_name>;

CREATE TABLE <database_name>.<schema_name>.<table_name> (
    <col_name> <col_type>,
    <col_name> <col_type>,
    ...
);

Example

Example custom payload

The names in the payload must match the column names used in the Snowflake table, as these fields are mapped directly when the data is ingested through Snowpipe Streaming.

Create the Snowpipe Streaming pipe

Create a pipe that reads data from the Snowpipe Streaming data source.

Example

This pipe defines how incoming streamed data is mapped to the columns of the target table.

Each field referenced with $1:<field_name> corresponds to a field in the JSON payload sent to Snowflake via Snowpipe Streaming. The field names must match the fields used in the custom payload described in the previous section.

Create a role with required privileges for Snowpipe Streaming ingestion

To follow the principle of least privilege, it is recommended to create a dedicated role that only allows the connector to ingest data through the Snowpipe Streaming pipe. This role will be assigned to a service user used by the connector.

Create the role

Create a dedicated role that will be used for Snowpipe Streaming ingestion. This role will have only the privileges necessary to ingest data

Example

Grant required privileges

Grant the minimal privileges required for the role to access the database, schema, and streaming pipe.

circle-info

Note: You have two options to run the commands:

  1. Run each command separately – place your cursor on a command and execute it. This works fine for all four commands.

  2. Run all commands at oncedo not just copy and paste all commands and hit run. If you paste all four and execute without selecting them, only the command where your cursor is will run (usually the last one), which can cause errors.

Example

Create a Snowpipe Streaming user

Create a user that will be used by the connector to authenticate with Snowflake.

The akenza Snowflake connector authenticates using RSA key pair authentication.

Akenza public key:

Example

Grant the required role

Grant the necessary role to the user.

Example

Verify the configuration (optional step)

You can run the following commands to verify that the user, pipe, privileges, and data ingestion are configured correctly.

Finding Your Snowflake Account Identifier and URL

To configure a Snowflake output connector, you will need your account identifier and URL.

You can find both directly in the Snowflake web interface.

  1. Log in to your Snowflake account.

  2. Look at the account settings (bottom-left corner or as shown in the screenshot below). Navigate to View account details. You will see: - Account identifier - a string like ZQPUGTG-YF50693 - Account/Server URL - a hostname like ZQPUGTG-YF50693.snowflakecomputing.com

  3. Use these values when creating a new Snowflake output connector: - Account identifier: <your-account-identifier>, like ZQPUGTG-YF50693 - URL: <your-account-url>, like https://ZQPUGTG-YF50693.snowflakecomputing.com (prepend https:// to the hostname)

Troubleshooting

If ingestion does not work as expected, check the following link.

Last updated

Was this helpful?