Skip to content

Snowflake

LIVE Destination

PortPilot loads each synced table into a Snowflake table in the schema you choose. Rows are uploaded to your PortPilot user’s own stage and loaded with COPY INTO, Snowflake’s bulk loader. Changed rows are merged on the primary key. Tables and new columns are created automatically.

  1. Create a role, warehouse access and a service user (run as ACCOUNTADMIN or a role with equivalent privileges):

    CREATE ROLE PORTPILOT_ROLE;
    GRANT USAGE ON WAREHOUSE <warehouse> TO ROLE PORTPILOT_ROLE;
    GRANT USAGE ON DATABASE <database> TO ROLE PORTPILOT_ROLE;
    GRANT USAGE, CREATE TABLE ON SCHEMA <database>.<schema> TO ROLE PORTPILOT_ROLE;
    CREATE USER PORTPILOT_SVC TYPE = SERVICE DEFAULT_ROLE = PORTPILOT_ROLE
    DEFAULT_WAREHOUSE = <warehouse>;
    GRANT ROLE PORTPILOT_ROLE TO USER PORTPILOT_SVC;

    The role owns the tables it creates, so it can insert, merge, truncate and alter them. If PortPilot should write into existing tables, grant INSERT, UPDATE, DELETE, TRUNCATE on them, or transfer ownership. No stage grants are needed: PortPilot uses the user’s own stage (@~).

  2. Set up key-pair authentication. Snowflake blocks password sign-in for service users. Generate a key pair:

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

    Register the public key (the body of rsa_key.pub, without the BEGIN/END lines):

    ALTER USER PORTPILOT_SVC SET RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...';

    An encrypted private key works too; give its passphrase in private_key_passphrase.

  3. Network policies: if your account restricts sign-in by IP, add PortPilot’s egress IPs (shown on the destination screen) to the user’s network policy.

In the app, go to Destinations → New destination → Snowflake and click Test connection after filling in:

Field Required Default Description
account Yes — Account identifier, e.g. myorg-myaccount or myorg.us-east-1.
user Yes — The service user, e.g. PORTPILOT_SVC.
private_key Yes* — Contents of rsa_key.p8 (PKCS#8 PEM). Line breaks lost when pasting are fine. Stored write-only.
private_key_passphrase No — Only if the private key is encrypted. Stored write-only.
password No* — Deprecated. Password sign-in, kept only for existing destinations. Stored write-only.
warehouse Yes — Virtual warehouse that runs the loads.
database Yes — Target database.
schema Yes PUBLIC Target schema.
role No user’s default Role to use, e.g. PORTPILOT_ROLE.

* Set exactly one of private_key or password. Both, or neither, fails with a config_invalid error.

  • Tables are named after the source table or stream and created on the first load. Table and column names are stored in upper case.
  • Names are upper-cased and quoted, so orders lands as ORDERS and created_at as CREATED_AT, and reserved words (order → "ORDER") and names with spaces ("FIRST NAME") work. Quote those in queries.
  • New columns are added with ALTER TABLE … ADD COLUMN. Existing columns are never changed or dropped.
  • No PortPilot metadata columns are added.
PortPilot typeDestination type
integerNUMBER
numberFLOAT
booleanBOOLEAN
objectVARIANT
arrayARRAY
stringVARCHAR
Write mode When What happens
Upsert Tables with a primary key Rows are copied into a temporary table, then MERGE INTO the target on the primary key.
Replace Full reads of tables without a primary key TRUNCATE, then COPY INTO.
Append Incremental reads of tables without a primary key COPY INTO.

The staged file is removed after every load, whether it succeeded or not.

  • Password sign-in fails for service users. Use key-pair authentication; existing password destinations should switch by setting private_key and clearing password.
  • Warehouse cost. Each load resumes the warehouse. Frequent syncs keep it running; use a small warehouse with a short AUTO_SUSPEND dedicated to PortPilot, so you can see its cost.
  • Timestamps land as VARCHAR. Cast with TO_TIMESTAMP_TZ(created_at) in a view or dbt model.
  • One bad value fails the table’s load. COPY INTO aborts on a value that doesn’t fit the column type (for example text arriving in a NUMBER column after a source type change). The error names the column.
  • Large single-table loads need memory. Each table’s rows for a sync are prepared in one file; very large initial syncs of one table take longer and use more compute.