Skip to content

Snowflake integrator setup

Operator setup for a Snowflake target in ELTMaestro — the JDBC connection and, the focus of this doc, key-pair (JWT) authentication. Companion to REDSHIFT-SETUP.md and MPP-SETUP.md; same operator-doc shape. Snowflake is one of the catalog-backed cloud platforms; loads go flat file → S3 stage → Snowflake (the S3 + system.cfg wiring is shared with the other MPP integrators — see MPP-SETUP.md).

At a glance — what you need

Prerequisite Detail
Snowflake account Reachable from the engine host; a database + schema + warehouse for the integrator.
Snowflake JDBC driver snowflake-jdbc-3.17.1.jar (also shipped as MPP_Driver_SnowFlake_JDBC.jar) under $MAESTRO_ENGINE_HOME/library/JDBC/; driver class net.snowflake.client.jdbc.SnowflakeDriver.
Auth Password (user + password) or key-pair / JWT (a private key file referenced from the connection string — see Key-pair authentication).
Object storage An S3_CONNECTION (or equivalent) for staging — same as the other MPP integrators (MPP-SETUP.md).
base64 decode Native — no UDF. $B64EXPRESSION uses Snowflake base64_decode_string(…).
JVM + classpath --add-opens=java.base/java.nio=ALL-UNNAMED (Arrow result reader, Java 17+) and jaxb-api-2.3.1.jar (javax namespace, key-pair PEM parse on Java 9+) on every engine/meta-service launch — see Hardening.
Integrator metadata system.cfg (defines $SYSTEM_TOKEN_ENCLOSER, $OBJECT_STORAGE, $B64EXPRESSION, drop/view queries) deployed at $PGDIR/metadata/integrators/snowflake/; laid down by the installer — must also be present on slave/edge nodes, else generated DDL carries unsubstituted $SYSTEM_* tokens.

1. Create the Snowflake JDBC connection

In the WPF client, navigate Administration ▸ Configure Maestro Server to open the Admin Interface (admin-role users only), select the Database Connections tab, then Create (or Edit a row) to open the JDBC connection editor (SysJdbcSetting). The connection is persisted to t_jdbc (connection_name, connection_string, jdbc_driver_name, user_name, password64 (base64), jdbc_driver_jar).

Field Value
Driver jar MPP_Driver_SnowFlake_JDBC.jar (or snowflake-jdbc-3.17.1.jar)
Driver class net.snowflake.client.jdbc.SnowflakeDriver
Connection string jdbc:snowflake://<account>.snowflakecomputing.com/?db=<DB>&schema=<SCHEMA>&warehouse=<WH>
User the Snowflake login name
Password required for password auth; ignored when a key is supplied (see below)

Key-pair (JWT) authentication

ELTMaestro prioritizes key-pair auth for Snowflake: when the connection string contains private_key_file, the connection authenticates with the key (JWT) and the password is ignored, even if one is set. This applies to both the batch engine and the SOAP meta-service (the connection Test button), so both behave the same way.

1. Generate an RSA key pair

# unencrypted private key (PKCS#8)
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
# public key
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
For an encrypted key, drop -nocrypt (you'll set a passphrase) and supply it via private_key_file_pwd in the connection string (below).

2. Assign the public key to the Snowflake user

In Snowflake (strip the -----BEGIN/END PUBLIC KEY----- lines and newlines):

ALTER USER <login> SET RSA_PUBLIC_KEY='MIIBIjANBgkq...';

3. Place the private key on the hosts

The private key file must exist and be readable by the engine's OS user on every host that opens the connection — the engine host and the meta-service. In the Docker deploy that means the key inside the eltmaestro container at the path you reference (e.g. /opt/iserver/secrets/rsa_key.p8). Protect it: chmod 600.

4. Reference the key from the connection string

Append the Snowflake JDBC key-pair parameters to the connection string:

Parameter Purpose
private_key_file=/opt/iserver/secrets/rsa_key.p8 path to the PKCS#8 private key (presence of this triggers key auth)
private_key_file_pwd=<passphrase> only for an encrypted key
authenticator=snowflake_jwt optional — ELTMaestro auto-adds this when absent, so you normally don't need it

Example:

jdbc:snowflake://<account>.snowflakecomputing.com/?db=<DB>&schema=<SCHEMA>&warehouse=<WH>&private_key_file=/opt/iserver/secrets/rsa_key.p8

With that connection string, leave the password blank or set — either way it is not used. To switch back to password auth, remove private_key_file from the connection string.

Why the password is ignored: the connection object detects private_key_file in the string and opens the connection with key-pair properties only (user + authenticator=snowflake_jwt), never passing the password to the driver. The Snowflake JDBC driver reads private_key_file (and private_key_file_pwd) straight from the connection string, so ELTMaestro does not load or parse the key itself.

Hardening — JVM flags, JAXB, and snowsql

Three host-level prerequisites that a fresh / edge / JDK-upgraded install must satisfy. All three are baked into the standard installer + Docker image; the failures below look like Snowflake/auth problems but are really JVM-module or classpath gaps — verify them after any manual install, edge node, or Java upgrade.

Remote --server / slave nodes run a separate ELTMaestro install and need every item here applied locally — the private key file, --add-opens, javax jaxb-api, the integrator metadata, and an NTP-synced clock (a skewed clock makes Snowflake reject the time-bounded JWT). The master's fixes do not propagate to them. Full per-node checklist + a verify-and-remediate script: SNOWFLAKE-SLAVE-REMEDIATION.md.

1. --add-opens for the Arrow result reader — every JVM that runs a Snowflake job

The driver fetches result sets via Apache Arrow, which on Java 17+ needs deep reflective access to java.nio:

--add-opens=java.base/java.nio=ALL-UNNAMED

Without it the connect succeeds but the first result fetch throws (so it looks like a query/driver bug, not a JVM one):

java.lang.RuntimeException: Failed to initialize MemoryUtil. Was Java started with
  `--add-opens=java.base/java.nio=ALL-UNNAMED`?
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field
  long java.nio.Buffer.address accessible …

The flag must be present on every path that launches the engine — a gap on any one of these silently fails just that path:

Launch path Where the flag lives
env_integrator export MAESTRO_ENGINE_OPTS="--add-opens=java.base/java.nio=ALL-UNNAMED" (sourced by all launches)
Local / meta-service batch MaestroMeta builds java $MAESTRO_ENGINE_OPTS -jar sqlm.jar …
cron-scheduled jobs the crontab line must read java $MAESTRO_ENGINE_OPTS -jar …. The WPF CronScheduler now emits it, but an older crontab hand-edited to java -jar … (no opts) silently fails every scheduled Snowflake job — fix the launch line.
slave-dispatched jobs (--server <host>) BatchThread passes $MAESTRO_ENGINE_OPTS to the remote --slave JVM; the slave's own env_integrator must define it too.
meta-service WAR (connection Test) the WAR launch includes the same --add-opens.

2. jaxb-api (javax namespace) on the classpath — key-pair JDBC on Java 9+

The driver parses the PKCS#8 private key with javax.xml.bind.DatatypeConverter, which was removed from the JDK in Java 11+. The engine ships jaxb-api-2.3.1.jar (the javax namespace) under library/JDBC/ / engine/lib/. If only the jakarta namespace (jakarta.xml.bind-*) is present — the wrong package — key-pair auth fails even though the key and Snowflake user are correct:

net.snowflake.client.jdbc.SnowflakeSQLLoggedException:
  Private key provided is invalid or not supported: /path/rsa_key.p8
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter

Fix: put jaxb-api-2.3.1.jar on the engine and meta-service classpath (already there in the standard install; add it by hand on an edge/upgraded host). Note jakarta.xml.bind does not substitute — the driver references the legacy javax.* class by name.

3. snowsql key-pair for the internal-stage PUT (Corelli pipeline)

The Corelli streaming pipeline (e.g. Salesforce → Snowflake) stages part-files through a Snowflake internal stage using the snowsql CLI (get_corelli_put_script), separately from the JDBC COPY. This is automatic: the engine (Job.java SNOWFLAKE block) sets $CURRENT_PRIVATE_KEY_FILE from the connection string's private_key_file, and get_corelli_put_script picks the matching auth — --private-key-path when it's set, otherwise password (--authenticator snowflake + base64-decoded SNOWSQL_PWD):

if [ -n "$CURRENT_PRIVATE_KEY_FILE" ]; then
  SNOWSQL_AUTH="--private-key-path $CURRENT_PRIVATE_KEY_FILE"   # key-pair / JWT
else
  export SNOWSQL_PWD=`echo "$CURRENT_PASSWORD_ENCODED" | base64 -d`
  SNOWSQL_AUTH="--authenticator snowflake"                     # password
fi
snowsql -a $CURRENT_ACCOUNT -u $CURRENT_USER … $SNOWSQL_AUTH -q "$PUTFILE_COMMAND"

No per-host edit, it matches whatever the JDBC connection uses, and it survives a reseeding/destructive deploy (both the engine var and the put script ship from source). Before this, a password-only put script against a key-pair user failed the PUT with Incorrect username or password while the JDBC side authenticated fine.

4. The $OBJECT_STORAGE connection must actually exist

S3-staged loads (ONSTAGEGROUP / bulk loaders) resolve their stage from $OBJECT_STORAGE in system.cfg (e.g. S3_CONNECTION). On a fresh box that named cloud connection often doesn't exist yet in connection2, so those loads fail to resolve a stage. Create the object-storage connection and make its name match $OBJECT_STORAGE (mismatches also bite after a destructive deploy reseeds system.cfg from the image default). The Corelli/internal-stage path above does not need it.

base64 decode (native, no UDF)

$B64EXPRESSION=base64_decode_string($COLUMN)::$DATATYPE — used by the pipeline's decoder view to base64-decode columns the source encoded (e.g. the Salesforce encoded-extract). No UDF to install. See REDSHIFT-SETUP.md for the cross-vendor picture.

On the Salesforce extract side, encoding is driven by the SF field type: every field is base64-encoded (to preserve whitespace/special characters) except the no-encode types — id, boolean, int, double, currency, percent, date, datetime, time, phone — which are written raw. (The raw SF field type is carried through the extract, so currency/percent/time/phone — which map to a SQL VARCHAR but aren't free text — stay raw rather than being needlessly encoded.) Encoding is active only when the target vendor defines $B64EXPRESSION.

Staging is sized by measurement, not estimate (Snowflake): the transient internal "volt" staging table that receives the base64 COPY is created with its encoded columns at the dialect max VARCHAR(16777216) — it is dropped right after the load, so the width is free and the COPY can never overflow regardless of how large a value inflates. The decoded target columns are then widened from the actual decoded data (a single MAX(LENGTH()) pass over the decoder view), so a column is exactly as wide as the data requires with no guessing.

Query attribution (QUERY_TAG)

Every Snowflake session the engine opens is tagged, so queries can be attributed back to the batch that issued them from Snowflake's own query history instead of only from engine logs. Nothing to configure — it is automatic for any connection using an MPP_*Snowflake* driver jar.

The tag is a JSON object, set once per physical connection via ALTER SESSION SET QUERY_TAG:

{"batch":"12345","batchName":"MY_BATCH","run":"7",
 "ACCOUNT":"xy12345.eu-west-1","WAREHOUSE":"COMPUTE_WH","ROLE":"ETL_ROLE",
 "DATABASE":"ANALYTICS","SCHEMA":"STAGING","USERNAME":"maestro_svc",
 "CONNECTIONNAME":"SNOWFLAKE_PROD"}

batch / batchName / run come from the batch's runtime variables ($BATCH_ID, $BATCH_NAME, $BATCH_RUN_NUMBER); the upper-case keys are properties parsed from the JDBC connection string.

Only an allowlist of connection properties is published. Credentials that appear in a connection URL — password, PWD, private keys, tokens — are never included. This matters because QUERY_TAG lands in SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY, which is readable by monitoring and ACCOUNTADMIN roles, retained for about a year, and cannot be purged by the engine. To publish an additional property, add it to the allowlist in JdbcConnection.TAG_SAFE_PROPS — never widen it to include a secret.

Reading it back

Use INFORMATION_SCHEMA.QUERY_HISTORY() while testing — it is near-real-time, whereas ACCOUNT_USAGE.QUERY_HISTORY can lag up to ~45 minutes:

select
    parse_json(query_tag):batchName::string as batch_name,
    parse_json(query_tag):batch::string     as batch_id,
    parse_json(query_tag):run::string       as run_number,
    count(*)                                as queries,
    sum(credits_used_cloud_services)        as cloud_credits
from table(information_schema.query_history())
where query_tag is not null
group by 1,2,3
order by queries desc;

Scope and behaviour

  • Batch-level, not step-level. Engine connections are pooled and reused across steps within a batch, so one session serves many steps; the tag identifies the batch and run, not the individual step.
  • Query text is never modified. Attribution is carried in session state rather than inline SQL comments, precisely so Snowflake's result cache (which keys on exact query text) keeps working.
  • Best-effort. If tagging fails for any reason it is silently skipped — it can never fail a job or block a connection.
  • Oversized tags degrade gracefully. QUERY_TAG is capped at 2000 characters; if the payload would exceed it the connection properties are dropped and the batch identity is kept, so the value stays valid JSON.
  • Snowflake only. Other vendors have no equivalent session tag wired up. Redshift's nearest equivalent (query_group) is deliberately not enabled — it is capped at 30 characters and doubles as a WLM routing key, so setting it could silently move queries to a different queue.

Integrator config (system.cfg)

Shared with the other MPP integrators — object storage ($OBJECT_STORAGE), drop/view queries, and $B64EXPRESSION above. See MPP-SETUP.md.

Verify

  1. Connection test: in the JDBC connection editor, click Test — the meta-service opens the connection. With private_key_file set it should succeed via JWT (no password prompt/error).
  2. Run a job: execute a small pipeline targeting Snowflake; confirm select current_warehouse() resolves (the engine reads it post-connect) and the load completes.
  3. Query attribution: after that job, run the information_schema.query_history() query in Query attribution — the batch name and run number should appear against the queries the job issued.

Common failures

Symptom Cause / fix
JWT token is invalid Public key not assigned/mismatched on the Snowflake user, or host clock skew — the JWT is time-bounded, so a clock off by >~1 min is rejected even with a valid key (the usual cause on a slave whose NTP is off). Re-run ALTER USER … SET RSA_PUBLIC_KEY; sync the clock (chronyd/ntpd, then chronyc makestep). Remote nodes: SNOWFLAKE-SLAVE-REMEDIATION.md.
DDL fails with literal $SYSTEM_TOKEN_ENCLOSER / unsubstituted $SYSTEM_* tokens (e.g. create table … ($SYSTEM_TOKEN_ENCLOSERCol$SYSTEM_TOKEN_ENCLOSER …)) The integrator metadata isn't installed at $PGDIR/metadata/integrators — the engine reads system.cfg (which defines $SYSTEM_TOKEN_ENCLOSER, $OBJECT_STORAGE, $QUERY_*, $B64EXPRESSION) from there. The installer now deploys it on server/edge/upgrade (INSTALL.md / EDGE-NODE-SETUP.md); on a stale node re-run the installer or copy the metadata tree. Most common on remote --server slaves — see SNOWFLAKE-SLAVE-REMEDIATION.md.
Private key file not found / permission denied The path in private_key_file doesn't exist or isn't readable by the engine/meta-service OS user. Place the key on both hosts and chmod 600.
Encrypted-key decrypt error Missing/incorrect private_key_file_pwd for an encrypted .p8.
Still authenticating by password private_key_file not actually present in the connection string (check spelling/case).
Failed to initialize MemoryUtil … --add-opens / InaccessibleObjectException: … java.nio.Buffer.address Missing --add-opens=java.base/java.nio=ALL-UNNAMED on that launch path (Java 17+ Arrow). See Hardening §1 — check env_integrator, the crontab line, and slave hosts.
Private key provided is invalid or not supported + ClassNotFoundException: javax.xml.bind.DatatypeConverter Missing jaxb-api-2.3.1.jar (javax) on the classpath — not an actual key problem. See Hardening §2.
snowsql PUT Incorrect username or password (JDBC works) An old get_corelli_put_script that predates auto-select is hardcoding password auth against a key-pair user. The current script chooses via $CURRENT_PRIVATE_KEY_FILE — update to it. See Hardening §3.
S3-staged load can't find the stage / $OBJECT_STORAGE unresolved The named object-storage connection (e.g. S3_CONNECTION) doesn't exist or its name ≠ $OBJECT_STORAGE. See Hardening §4.
COPY: User character length limit (N) exceeded on a base64 column Should no longer occur: the transient volt staging now creates base64 columns at the dialect max VARCHAR(16777216) (dropped after load → free, can't overflow). If you see this on an older engine, upgrade — earlier builds sized the staging from an estimate (the SF-declared width × 4⁄3) and a longer-than-declared value (rich-text/HTML, compound address fields) could still overflow.
Decoded value String … is too long and would be truncated into the target _STAGE table The decoded value exceeds the target column width. The engine now measures MAX(LENGTH()) of each decoded column over the decoder view and ALTERs the target columns to fit before the insert, so this self-corrects. On Snowflake the cap is 16 MB; a single value beyond that genuinely can't be stored.