Snowflake
LIVE Destination
Overview
Section titled “Overview”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.
Before you connect
Section titled “Before you connect”-
Create a role, warehouse access and a service user (run as
ACCOUNTADMINor 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_ROLEDEFAULT_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, TRUNCATEon them, or transfer ownership. No stage grants are needed: PortPilot uses the user’s own stage (@~). -
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 -nocryptopenssl rsa -in rsa_key.p8 -pubout -out rsa_key.pubRegister the public key (the body of
rsa_key.pub, without theBEGIN/ENDlines):ALTER USER PORTPILOT_SVC SET RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...';An encrypted private key works too; give its passphrase in
private_key_passphrase. -
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.
Connect
Section titled “Connect”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.
Schema
Section titled “Schema”- 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
orderslands asORDERSandcreated_atasCREATED_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 type | Destination type |
|---|---|
| integer | NUMBER |
| number | FLOAT |
| boolean | BOOLEAN |
| object | VARIANT |
| array | ARRAY |
| string | VARCHAR |
Sync behavior
Section titled “Sync behavior”| 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.
Common gotchas
Section titled “Common gotchas”- Password sign-in fails for service users. Use key-pair authentication; existing password
destinations should switch by setting
private_keyand clearingpassword. - Warehouse cost. Each load resumes the warehouse. Frequent syncs keep it running; use a
small warehouse with a short
AUTO_SUSPENDdedicated to PortPilot, so you can see its cost. - Timestamps land as
VARCHAR. Cast withTO_TIMESTAMP_TZ(created_at)in a view or dbt model. - One bad value fails the table’s load.
COPY INTOaborts on a value that doesn’t fit the column type (for example text arriving in aNUMBERcolumn 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.