Skip to contentManaged Kafka is live: Apache Kafka on AWS for half the cost of MSK

Destinations

Snowflake

Configure Snowflake as a destination in Artie with service account setup, key-pair authentication, and advanced features like turbo mode and eco mode.

Required settings

  • Account identifier
  • Virtual warehouse
  • Service account
  • Database name
  • Schema name
Account identifier

You can find your account identifier at the bottom left corner of your Snowflake console.

Service account script

Artie signs in to Snowflake with a key pair. Generate one first:

Bash
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub

Then run this script, with the public key in rsa_public_key:

SQL
BEGIN TRANSACTION;
    USE ROLE ACCOUNTADMIN; -- This combines both SYSADMIN and SECURITYADMIN

    -- IMPORTANT, PLEASE FILL THIS OUT AND SAVE THIS --
    SET ROLE_NAME = 'ARTIE_TRANSFER_ROLE';
    SET SERVICE_USER = 'ARTIE';
    SET DWH_NAME = UPPER('DWH');
    SET DB_NAME = UPPER('DB_NAME');
    SET SCHEMA_NAME = UPPER('public');
    -- END IMPORTANT --
    SET DB_SCHEMA_NAME = CONCAT($DB_NAME, '.', $SCHEMA_NAME);

    CREATE ROLE IF NOT EXISTS identifier($ROLE_NAME);
    CREATE USER IF NOT EXISTS identifier($SERVICE_USER)
        rsa_public_key = '<contents of rsa_key.pub, without the BEGIN and END lines>'
        default_role = $ROLE_NAME;
    GRANT ROLE identifier($role_name) to USER identifier($SERVICE_USER);
    CREATE WAREHOUSE IF NOT EXISTS identifier($DWH_NAME)
        warehouse_size = xsmall
        warehouse_type = standard
        auto_suspend = 10
        auto_resume = true
        initially_suspended = true;

    CREATE DATABASE IF NOT EXISTS identifier($DB_NAME);
    CREATE SCHEMA IF NOT EXISTS identifier($DB_SCHEMA_NAME);

    GRANT USAGE ON WAREHOUSE identifier($DWH_NAME) TO ROLE identifier($ROLE_NAME);
    GRANT USAGE ON DATABASE identifier($DB_NAME) TO ROLE identifier($ROLE_NAME);
    GRANT ALL PRIVILEGES ON SCHEMA identifier($DB_SCHEMA_NAME) TO ROLE IDENTIFIER($ROLE_NAME);
    -- Required when Snowpipe Streaming is enabled.
    GRANT CREATE PIPE ON SCHEMA identifier($DB_SCHEMA_NAME) TO ROLE identifier($ROLE_NAME);

    GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA identifier($DB_SCHEMA_NAME) TO ROLE IDENTIFIER($ROLE_NAME);
    GRANT ALL PRIVILEGES ON FUTURE TABLES IN SCHEMA identifier($DB_SCHEMA_NAME) TO ROLE IDENTIFIER($ROLE_NAME);
COMMIT;

In Artie, choose Private key as the authentication method and paste the contents of rsa_key.p8, including its BEGIN and END lines, into Private key.

Password (not recommended): Artie also accepts a password. Replace the rsa_public_key line with password = '<password>' and choose Password as the authentication method.

Adding a key pair to an existing user

If the service account already exists, generate a key pair with the commands above and assign the public key to the user:

SQL
ALTER USER ARTIE SET RSA_PUBLIC_KEY='MIIBIjANBgkqh...';

Then paste the private key into Private key in Artie.

Advanced features

Snowflake turbo mode

Artie continuously monitors the ingestion lag and row backlog for each pipeline writing to Snowflake. When both metrics exceed configurable thresholds, Artie automatically switches the pipeline to a larger Snowflake warehouse to accelerate catch-up. Once the backlog clears and metrics stay below thresholds for several consecutive checks, Artie scales back down to the pipeline’s normal warehouse.

How it works

  1. Monitoring

    Every 10 minutes, Artie queries the pipeline’s current ingestion latency (in minutes) and pending row count.

  2. Scale up

    If both the latency and row backlog exceed their thresholds, the pipeline is switched to the configured turbo warehouse and you are notified.

  3. Scale down

    Once both metrics drop below thresholds for 3 consecutive checks, the pipeline is returned to its normal warehouse and you are notified again.

Configuration

SettingDefaultDescription
Larger warehouse(required)The larger Snowflake warehouse to use during high-load periods.
Latency threshold30 minutesIngestion lag must exceed this value (along with the row threshold) to trigger scale-up.
Row lag threshold5,000,000 rowsPending row count must exceed this value (along with the latency threshold) to trigger scale-up.

You can activate this feature by going to your pipeline’s destination advanced settings.

Key behaviors

  • Both thresholds must be exceeded simultaneously to activate turbo mode. A spike in only one metric will not trigger a scale-up.
  • Scale-down requires 3 consecutive below-threshold checks to avoid flapping between warehouses.
  • You will receive a notification whenever turbo mode is activated or deactivated.
Snowflake turbo mode

Snowflake eco mode

Steps to enable eco mode
  1. Edit your pipeline.
  2. Open the Destination tab, then Advanced settings.
  3. Under Optimizations, select Enable Snowflake Eco Mode, then New schedule.
  4. Name the schedule and set its peak hours and Timezone.
  5. Set the flush rules for off-peak hours.
  6. Select Save schedule.
  7. Deploy your changes.

Snowflake Eco Mode schedule

Peak hours

Flush rules for off-peak hours

Week (America/New_York)

  • Peak: the pipeline's own flush rules
  • Off-peak: flushes every 6 h, or sooner once 99,999 rows or 25,000 KB are waiting

Peak hours: Mon–Fri, 08:00 AM to 06:00 PM (America/New_York), on the pipeline's own flush rules. Off-peak, the rest of the week: flushes every 6 h, or sooner once 99,999 rows or 25,000 KB are waiting.

Rebuild and swap backfills

A backfill can load into a new table and swap it with the destination table when it finishes, so queries never see the table empty or partially loaded. This is in early access. See Rebuild and swap backfills.

Dynamic tables

For high-throughput tables, Artie can stream every change into an append-only table and let a Snowflake dynamic table keep the latest row per key, instead of merging each batch. This is in early access. See Snowflake dynamic tables.

Troubleshooting

How should I size my virtual warehouse?

To start, We would recommend you to go with a x-small and decide whether or not you need to scale based off of our Snowflake insights metrics from our Analytics portal.

Generally speaking, if your overall query execution time is high, then you may want to scale to a larger instance. If your queued overload time is high, you may want to have more virtual warehouse nodes to increase your parallelizable slots.

Why am I not able to query or operate table?

Snowflake’s native RBAC makes it so that the account that created the resource is the native owner. To change this, assign the ARTIE service account’s role to your account and you will be able to operate on the table. See the GIF below on how to fix this problem.