Drivers

Snowflake Driver Documentation

This documentation explains the Snowflake driver implementation and how connection parameters map to UI fields in the Gigantic application. The driver reads and writes the tables of a Snowflake database (one schema, or every schema of the database) with the official Snowflake Node.js connector.

Snowflake is listed under Cloud datasources in the driver selector and requires a Cloud license tier.

Connection Parameters

UI FieldTechnical ImplementationDescriptionRequiredDefault Value
Accountaccount (sent as host)Account identifier, for example myorg-myaccount or xy12345.eu-west-1. An account URL (https://myorg-myaccount.snowflakecomputing.com) is also takenYesNone (must be specified)
Databasedatabase (sent as database)Database with the tablesYesNone (must be specified)
Schemaschema (sent as dbSchema)Schema with the tables. Empty: every schema of the database, and the entities are named <schema>.<table>NoEvery schema
Warehousewarehouse (sent as owner)Warehouse that runs the queries and loadsNoThe default warehouse of the user
Rolerole (sent as container)Role of the sessionNoThe default role of the user

Notes:

  • The form has no Port field. The driver connects over HTTPS to <account>.snowflakecomputing.com.
  • Tables are addressed as "<database>"."<schema>"."<table>", each part quoted. Names are kept as Snowflake stores them, usually in uppercase.
  • The driver sets the date and time formats of its session (DATE_OUTPUT_FORMAT, TIMESTAMP_*_OUTPUT_FORMAT...) and QUOTED_IDENTIFIERS_IGNORE_CASE = FALSE. Other session parameters of the user are kept.

If a required value is missing the connection fails with one of these errors:

Snowflake account is required
Snowflake user is required

Authentication Options

Auth TypeUI MappingDescription
Key PairUser, Private Key and Passphrase fieldsThe recommended one. The private key of the user (PKCS#8 PEM, encrypted or not) and its passphrase. Both are stored encrypted. The public key is set on the user with ALTER USER ... SET RSA_PUBLIC_KEY = '...'
User / PasswordUser and Password fieldsPassword of the user. Snowflake is phasing out single-factor passwords: prefer Key Pair for a service user
OAuthUser and Access token fieldsAn OAuth access token (of a Snowflake security integration or an external identity provider). Tokens expire: refresh it from a password manager or Custom Params
Password ManagerPassword manager fieldsThe user and password are read from the password manager

Privileges

UsePrivileges of the role
TapUSAGE on the warehouse, database and schema, and SELECT on the tables (or IMPORTED PRIVILEGES on a shared database)
SinkAlso CREATE TABLE and CREATE STAGE on the schema, and INSERT, UPDATE, TRUNCATE on the tables it writes

Technical Details

The Snowflake driver uses the official snowflake-sdk library.

Connection process:

  1. Opens a connection to the account with the authentication of the form
  2. Sets the formats of the session
  3. Runs SELECT 1 to check the connection

The connector writes no snowflake.log file: its errors go to the log of the job.

Schema discovery:

  • Lists the tables and views of the database (or schema) from INFORMATION_SCHEMA.TABLES, with their row count and size
  • Reads the columns of all the tables with one query of INFORMATION_SCHEMA.COLUMNS
  • Reads primary keys with SHOW PRIMARY KEYS and foreign keys with SHOW IMPORTED KEYS. Snowflake does not enforce them, but they give the relations for referential integrity
  • Stores the DDL of each table from GET_DDL only when the rule extracts DDL. A table the sink creates is made from the fields, so no DDL is needed
  • Marks Iceberg tables and the tables of a shared database

Type mapping:

Snowflake TypeGigantic TypeValues
NUMBER with scale 0 (INT, BIGINT...)numberNumbers. Past 2^53 the exact text
NUMBER with scale, DECIMALfloatThe exact decimal text
FLOAT, DOUBLE, REALfloatNumbers
BOOLEANbooleanBooleans
DATE, TIMESTAMP_NTZdateThe local time of the Gigantics server, as with the other drivers
TIMESTAMP_LTZ, TIMESTAMP_TZdateThe instant
VARCHAR, TEXT, CHAR, TIMEstringText
BINARYbufferBytes
VARIANT, OBJECT, ARRAY, GEOGRAPHY, GEOMETRY, VECTORobjectJSON values. They are parsed as JSON, never evaluated

Reading process

  1. Builds a SELECT with the rule where (with bind parameters), order, limit and offset
  2. Streams the rows of one result: Snowflake sends it in chunks that are downloaded from its cloud storage, 4 at a time (resultPrefetch)
  3. With keysetReads: true in Custom Params (or a rule with readMode: keyset), a table with a primary key is read in chunks by its key instead. Each chunk is a query of its own: such a read can resume where a job stopped and be read in ranges side by side, but on a table not clustered by its key each chunk may scan the table

The result chunks come from the cloud storage of the account (*.s3.amazonaws.com, *.blob.core.windows.net or storage.googleapis.com): a firewall must allow the stage hosts that SELECT SYSTEM$ALLOWLIST() lists.

Shared databases and Iceberg tables

A database of an inbound share, or a catalog-linked database of externally managed Iceberg tables (for example the Workday zero-copy share), is read like any other: point the tap at it. These databases are read only: use another database for the sink. Their table names may be in lowercase; the driver always quotes them as Snowflake lists them.

Writing process

  1. Each batch of the write batch size of the job or rule (when none is set, the driver batchSize, 50000) is written as a gzip file of JSON lines in a private temporary folder of the server
  2. The file is uploaded with PUT to a temporary stage of the session (or to loadStage) and loaded with COPY INTO ... MATCH_BY_COLUMN_NAME = CASE_INSENSITIVE, then deleted from the stage and from the disk
  3. Only the columns of the target table are written. VARIANT, OBJECT and ARRAY columns take the JSON values as they are; BINARY columns take hex
  4. Update and merge copy each batch into a temporary table of the session, then run one MERGE by the primary key. A key repeated in a batch keeps its last row
  5. When Retry On Fail is enabled, failed batches are split in half and retried

Write modes:

Write modeBehaviour
DropDROP TABLE IF EXISTS and creates the table again
TruncateTRUNCATE TABLE before loading
AppendLoads rows into the existing table
Update / MergeKeeps the table and runs MERGE by primary key. Fails if the table has no primary key

When the target table does not exist, it is created from the fields: with the types of a Snowflake source as they are, or mapped from another source (number as NUMBER(38,0), float as FLOAT or NUMBER(p,s), date as DATE, TIMESTAMP_NTZ or TIMESTAMP_TZ, object as VARIANT), with its primary key.

Filters and referential integrity

Where conditions run in Snowflake as a WHERE clause with bind parameters. ISO dates are compared by the column type: TIMESTAMP_LTZ and TIMESTAMP_TZ with the instant, TIMESTAMP_NTZ and DATE with the local time. Referential integrity works in filter and seed mode; random rows of a limited parent are ordered by HASH of the key.

SSH Tunnel Support

The Snowflake driver does not use SSH tunnels: the form has no Enable SSH? option. To go through an HTTP proxy, set proxyHost and proxyPort in Custom Params. For AWS PrivateLink or Azure Private Link, set the private host in accessUrl.

API Endpoints Used

Snowflake connections are used in:

  • Tap creation (data source discovery)
  • Sink creation (data destination for anonymized data)
  • Pipeline execution (data extraction and loading)

Node.js Driver Dependency

  • Library: snowflake-sdk
  • Purpose: Snowflake connections, queries, result streaming and PUT uploads

Custom Params

Custom Params (YAML) are merged into the driver configuration, so they can set or override these keys:

account: myorg-myaccount           # Overrides the Account field
warehouse: GIG_WH                  # Overrides the Warehouse field
role: GIG_ANONYMIZER               # Overrides the Role field
loadStage: '@HR.PUBLIC.GIG_STAGE'  # An existing stage for the loads
keysetReads: false                 # Read by the primary key in chunks
batchSize: 50000                   # Rows per load when the job or rule sets none
resultPrefetch: 4                  # Result chunks downloaded at the same time
accessUrl: https://myorg-myaccount.privatelink.snowflakecomputing.com
proxyHost: proxy.example.com
proxyPort: 8080

Example Configurations

The Workday share, read only

Database WORKDAY_SHARE, Schema HCM, authentication Key Pair. The sink is another Snowflake datasource on a database the role owns, or a BigQuery or File Storage sink.