Destinations
Snowflake
Connect Artie to Snowflake with a key-pair service account, then tune cost and speed with turbo mode, eco mode and Snowpipe Streaming.
Required settings
Enter these values on the pipeline’s destination tab. Field names match the Edit pipeline form. New-pipeline setup takes the account in one field, Snowflake URL or account identifier.
| Field | Required | What to enter |
|---|---|---|
| Account identifier | Yes | Your Snowflake organization and account name, joined by a hyphen: myorg-account123. |
| Username | Yes | The service account user, ARTIE in the service account script. |
| Private key | Yes, unless you use a password | The contents of rsa_key.p8. |
| Warehouse name | Yes | The virtual warehouse that runs Artie’s queries. |
| Role name | No | The role Artie runs as. Artie preselects the user’s default role. |
| Database name | Yes | The database Artie writes to. |
| Schema name | Yes | The schema Artie writes to. |
Find your account identifier
In Snowflake, select your account name in the bottom-left corner, then copy the account identifier.
Artie accepts the identifier as two parts joined by one hyphen, for example myorg-account123. If you copied myorg.account123, replace the dot with a hyphen.
To connect with an account locator URL instead, set Account identifier type to Legacy. Then enter the URL in Account URL, for example https://acme-test.us-east-2.aws.snowflakecomputing.com. The URL must start with https:// and end with .snowflakecomputing.com.
Create the service account
Artie signs in to Snowflake with a key pair. With a key pair, Artie validates the connection through Snowflake’s REST APIs, which skips warehouse queueing.
Generate an unencrypted private key:
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocryptThen derive the public key from it:
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pubIn Snowflake, run this script with the public key in rsa_public_key:
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;Set ROLE_NAME, SERVICE_USER, DWH_NAME, DB_NAME and SCHEMA_NAME to your own names before you run it. The script creates the role, user, warehouse, database and schema when they don’t exist.
In Artie, set Authentication method to Private key (recommended). Paste the contents of rsa_key.p8, including its BEGIN and END lines, into Private key. Artie shows “Key format is valid. Connection access is checked separately.”
Add a key pair to an existing user
If the service account already exists, generate a key pair with the openssl commands in Create the service account. Then assign the public key to the user:
ALTER USER ARTIE SET RSA_PUBLIC_KEY='MIIBIjANBgkqh...';Replace ARTIE with your user and MIIBIjANBgkqh... with the contents of rsa_key.pub, without the BEGIN and END lines. Then paste the private key into Private key in Artie.
Use a password instead
Artie also accepts a password, which is not recommended. Snowpipe Streaming and dynamic tables need a key pair.
In the service account script, replace the rsa_public_key line with password = '<password>'. In Artie, set Authentication method to Password.
Size the virtual warehouse
Start with an X-Small warehouse, the size the service account script creates. Then check Snowflake insights in the Analytics portal to decide whether to scale.
If execution time is high, move to a larger warehouse, which speeds up large, complex queries. If queued overload time is high, add clusters so more queries run at once. Multi-cluster warehouses need Snowflake Enterprise Edition or higher.
Advanced features
Turbo mode, eco mode, Snowpipe Streaming and external stages are pipeline settings. To reach them, select Edit pipeline, open the Destination: Snowflake tab, then expand Advanced settings.
Snowflake turbo mode
Turbo mode switches a running pipeline to a larger warehouse while it is behind, then switches it back. Artie decides from two metrics: ingestion lag and row lag.
Monitoring
Every 10 minutes, Artie reads the pipeline’s ingestion lag in minutes and its row lag.
Scale up
When both metrics reach their thresholds, Artie switches the pipeline to the larger warehouse and emails your team.
Scale down
After 3 consecutive checks with either metric under its threshold, Artie switches back to the pipeline’s own warehouse and emails your team.
A spike in only one metric doesn’t trigger a scale-up. Waiting for 3 checks stops the pipeline from flapping between warehouses. Artie skips a check when either metric is unavailable.
To turn turbo mode on, select Enable Snowflake Turbo Mode under Optimizations, then set these fields:
| Setting | Default | Description |
|---|---|---|
| Warehouse name | None (required) | The larger Snowflake warehouse to use while the pipeline is behind. |
| Latency threshold (minutes) | 30 | Ingestion lag, in minutes, that counts as behind. |
| Row lag threshold | 5,000,000 | Pending row count that counts as behind. |
The settings appear under the checkbox:
Snowflake eco mode
Eco mode flushes less often outside peak hours to cut Snowflake compute costs. It suits pipelines that only need fast syncs during business hours. For the reasoning behind it, read the Snowflake eco mode blog post.
Steps to enable eco mode
- On the pipeline’s overview page, select Edit pipeline.
- Open the Destination: Snowflake tab, then expand Advanced settings.
- Under Optimizations, select Enable Snowflake Eco Mode, then New schedule.
- Enter a Schedule name.
- Under Peak hours, select the days, then set Start time, End time and Timezone.
- Under Flush rules for off-peak hours, set the flush interval, flush size and row count.
- Select Save schedule. Artie shows “Snowflake Eco Mode schedule has been saved.” and selects the schedule.
- Select Deploy.
The schedule form looks like this:
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.
Any time outside the selected days, or outside the start and end times, is off-peak. A new schedule starts with these values:
| Field | Starting value |
|---|---|
| Start time | 08:00 |
| End time | 18:00 |
| Flush interval (seconds) | 21,600 (6 hours). The maximum is 86,400. |
| Flush size (KB) | 25,000 |
| Number of rows (de-duplicated) before flushing | 99,999 |
A saved schedule is available to every pipeline in the same environment.
Snowpipe Streaming
Snowpipe Streaming loads rows through Snowflake’s streaming API instead of COPY INTO. It applies when Artie loads rows straight into a table: tables Artie appends to, such as history mode tables, and the first load of a multi-step merge. Merges into existing tables still load with COPY INTO.
Snowpipe Streaming needs key-pair authentication and the CREATE PIPE privilege on the destination schema. The script in Create the service account grants CREATE PIPE.
To turn it on, select Use Snowpipe Streaming under Optimizations, then select Deploy. Artie creates one pipe per table in the table’s schema, named after the table with a _PIPE suffix, for example ORDERS_PIPE.
Snowpipe Streaming max channels sets how many channels Artie spreads each table’s rows across. Left blank, Artie uses 1 channel. Rows with the same key always use the same channel, so they stay in order.
Artie waits for Snowflake to commit every row before it treats a flush as done. It handles failures like this:
| Situation | What Artie does |
|---|---|
| Snowflake throttles a request (HTTP 429), returns a 5xx error or drops the connection | Retries the request up to 3 times, waiting 0.5 to 5 seconds between attempts. Each attempt times out after 2 minutes. |
| Rows don’t commit within 5 minutes | Fails the flush with timed out after 5m0s waiting for channels [...] to commit, then retries the flush. |
| A flush retries on a history mode table | Skips the rows Snowflake already committed and sends the rest, so no change is written twice. |
| Snowflake reports that the table was recreated or the pipe is invalid | Replaces the pipe and sends the batch again. |
Artie attempts each flush up to 15 times.
External stage
Artie stages files in Snowflake’s internal stage by default. To stage them in your own S3 bucket, create an external stage in Snowflake with this file format:
FILE_FORMAT = (TYPE = 'csv' FIELD_DELIMITER= '\t' FIELD_OPTIONALLY_ENCLOSED_BY='"' NULL_IF='__artie_null_value' EMPTY_FIELD_AS_NULL=FALSE)Then select Use an external stage under General and choose the stage in External stage. Artie lists the stages in the pipeline’s database and schema, so set both first.
Rebuild and swap backfills
A backfill can load into a new table and swap it with the destination table when it finishes. 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 instead of merging each batch. A Snowflake dynamic table then keeps the latest row per key. These tables always load through Snowpipe Streaming. This is in early access. See Dynamic tables.
Troubleshooting
This section covers access problems on tables Artie creates in Snowflake.
You can’t query or alter a table Artie created
Cause: Snowflake makes the role that created a table its owner. Artie creates the destination tables with the service account’s role, so that role owns them.
Fix: Grant the service account’s role to your own user. ARTIE_TRANSFER_ROLE is the role name in the service account script:
GRANT ROLE ARTIE_TRANSFER_ROLE TO USER YOUR_USER;Replace YOUR_USER with your Snowflake username. The same change in the Snowflake console:
Was this page helpful?
- Need help? Message us on Slack or email [email protected].
- Want a walkthrough? Book a demo.
- LLM? Read llms.txt.