Snowflake (S3 Staging)
Synopsis
The Snowflake S3 target stages telemetry files to Amazon S3, then executes COPY INTO commands on Snowflake to load data into tables.
Schema
- name: <string>
description: <string>
type: amazonsnowflake
properties:
account: <string>
username: <string>
password: <string>
database: <string>
schema: <string>
warehouse: <string>
role: <string>
staging_bucket: <string>
staging_prefix: <string>
region: <string>
key: <string>
secret: <string>
session: <string>
table: <string>
data_schema: <string>
name: <string>
format: <string>
compression: <string>
extension: <string>
tables:
- table: <string>
schema: <string>
name: <string>
format: <string>
compression: <string>
extension: <string>
batch_size: <integer>
max_size: <integer>
timeout: <integer>
part_size: <integer>
drop_unknown_stream_events: <boolean>
field_format: <string>
max_rows_per_rowgroup: <numeric>
buffer_size: <numeric>
data_page_version: <string>
metadata: <key-value>
debug:
status: <boolean>
dont_send_logs: <boolean>
Configuration
The following fields are used to define the target:
Base Target Fields
| Field | Required | Default | Description |
|---|---|---|---|
name | Y | - | Unique identifier for this target |
description | N | - | Human-readable description |
type | Y | - | Must be amazonsnowflake |
pipelines | N | - | Pipeline names to apply before sending |
status | N | true | Enable/disable the target |
Snowflake Connection
| Field | Required | Default | Description |
|---|---|---|---|
account | Y | - | Snowflake account identifier (e.g., abc123.us-east-1) |
username | Y | - | Snowflake username |
password | Y | - | Snowflake password |
database | Y | - | Snowflake database name |
schema | N | PUBLIC | Snowflake schema name. Must be a valid SQL identifier — letters, digits, and underscores only, not starting with a digit. |
warehouse | N | - | Snowflake virtual warehouse name |
role | N | - | Snowflake role name |
S3 Staging Configuration
| Field | Required | Default | Description |
|---|---|---|---|
staging_bucket | Y | - | S3 bucket name for staging files |
staging_prefix | N | snowflake-staging/ | S3 prefix path |
region | Y | - | AWS region for S3 bucket |
key | N* | - | AWS access key ID (uses default credentials chain if omitted) |
secret | N* | - | AWS secret access key |
session | N | - | AWS session token for temporary credentials |
* = key and secret take effect only when both are set. session applies only alongside them.
Table Configuration
| Field | Required | Default | Description |
|---|---|---|---|
table | Y* | - | Catch-all table name for all events |
data_schema | Y* | - | Avro/Parquet schema for the catch-all table: a Library name, a built-in name, an inline JSON definition, or a field:type,... list. When it is empty, the top-level schema is read in its place, which still has to be a valid SQL identifier because it is also the Snowflake schema. |
name | N | vmetric.{{.Timestamp}}.{{.Extension}} | File naming template |
format | N | json | File format. Use json, avro, or parquet — see the warning below. |
compression | N | zstd | Compression algorithm |
extension | N | - | File extension override. Defaults to the resolved format. |
tables | N | - | Multiple table configurations (see below) |
tables.table | Y | - | Target table name |
tables.schema | Y* | - | Avro/Parquet schema for this table: a Library name, a built-in name, an inline JSON definition, or a field:type,... list. A file name such as event_schema.avsc is not looked up, so it fails as an invalid field list. This table does not read data_schema. |
tables.name | Y | - | File naming template for this table |
tables.format | N | - | File format for this table. Falls back to the catch-all format. |
tables.compression | N | - | Compression algorithm for this table. Falls back to the catch-all compression. |
tables.extension | N | - | File extension override for this table. Falls back to the catch-all extension. |
Only json, avro, and parquet are written correctly. csv, orc, and xml pass configuration validation, but the staged file is written as JSON while the COPY INTO command still declares the requested format, so the load fails.
Parquet Options
These apply only when format is parquet.
| Field | Required | Default | Description |
|---|---|---|---|
max_rows_per_rowgroup | N | 10000 | Maximum rows per Parquet row group |
buffer_size | N | 262144 | Page buffer size in bytes (256KB) of the older Parquet writer only |
data_page_version | N | - | V1, or no value, uses the column-by-column writer, which writes version 1 data pages, unless the schema or the compression keeps the older writer. V2 keeps the older Parquet writer, which writes version 2 data pages. Before, the default was V2 |
metadata | N | - | Key/value pairs written into the Parquet file metadata |
How the staged files are written, which values they keep, and which outputs still use the older writer: see How Targets Write Parquet.
* = At least one of table (catch-all) or tables (multiple) must be configured. For Avro/Parquet formats, the catch-all table needs data_schema (or, failing that, schema) and every tables entry needs its own schema.
Batch Configuration
| Field | Required | Default | Description |
|---|---|---|---|
batch_size | N | 100000 | Maximum events per file before flush |
max_size | N | 33554432 | Maximum file size in bytes before flush (32MB) |
timeout | N | 300 | Seconds allowed for the staging upload and for the COPY INTO command |
part_size | N | 5 | S3 multipart upload part size in MB. Values below 5 are raised to 5. |
drop_unknown_stream_events | N | true | Drop events that do not match any configured table |
Normalization
| Field | Required | Default | Description |
|---|---|---|---|
field_format | N | - | Data normalization format. Any supported format is accepted; OCSF is a common choice for security data in a lakehouse. See applicable Normalization section |
Debug Options
| Field | Required | Default | Description |
|---|---|---|---|
debug.status | N | false | Enable debug logging for this target |
debug.dont_send_logs | N | false | Log events without sending to Snowflake |
Details
Architecture Overview
The Snowflake S3 target implements a two-stage loading pattern:
- Stage Files to S3: Events are written to files in S3 using the configured format
- Execute COPY INTO: SQL commands load data from S3 into Snowflake tables
Snowflake Connection
Account identifier:
- Format:
<account_locator>.<region>(e.g.,abc123.us-east-1) - Account locator is visible in your Snowflake URL
- Region is the cloud region where your Snowflake account is deployed
Authentication:
- Uses username/password authentication
- Credentials are used to connect to Snowflake SQL API v2
- Supports optional warehouse and role specification
Database and Schema:
- Database name is required and must be a valid SQL identifier
- Schema defaults to
PUBLICif not specified - Both database and schema names are validated for SQL compliance
The Snowflake user requires permissions to:
- Execute SQL statements using the specified warehouse
- Write data to the target database and schema
The COPY INTO command names the staged file as a plain s3:// URL. It sends no storage integration, no credentials and no named stage, so Snowflake has to be able to read the staging bucket on its own. The AWS key and secret upload the file and are never passed on to Snowflake. Before sending data, give the Snowflake account read access to the staging prefix on the bucket itself. No target setting passes a storage integration or credentials to the command, so a bucket that can only be read with them cannot be loaded from. When Snowflake cannot read the object, every load fails with 091003 Failure using stage area. Cause: [Access Denied] and no rows arrive.
S3 Staging Operations
File Upload:
- Files are staged to
s3://bucket/prefix/table/filenamestructure - Uses AWS SDK multipart upload for large files
- Supports AWS credentials chain (access key, IAM role, instance profile)
Cleanup:
- Staged files are automatically deleted after successful COPY INTO execution
- A staged file whose
COPY INTOis refused is deleted as well, so a failed load leaves nothing behind to inspect - The exception is a load whose outcome stays unknown, such as a
COPY INTOthat runs pasttimeout. That object is kept, and the retry stages a second copy of the same batch
File Format Support
Valid Formats:
- CSV: Comma-separated values with optional headers
- JSON: Newline-delimited JSON objects
- AVRO: Schema-based binary format (requires schema)
- ORC: Optimized row columnar format
- PARQUET: Columnar storage format (requires schema)
- XML: XML document format
Schema Requirements:
- Avro and Parquet formats require a schema definition:
data_schemafor the catch-all table,schemaon eachtablesentry - Schema must match the expected table structure in Snowflake
- Other formats use schema inference from data
Multi-Table Routing
Catch-All Table:
- Use
tablefield to send all events to a single table - Simplest configuration for single-destination scenarios
Multiple Tables:
- Use
tablesarray to route different event types to different tables - Each table entry specifies
table,schema,name,formatfields - Events routed based on SystemS3 field in pipeline
Example Configuration:
tables:
- table: security_events
schema: security_schema
name: security.{{.Timestamp}}.parquet
format: parquet
- table: access_logs
schema: access_schema
name: access.{{.Timestamp}}.parquet
format: parquet