Sources
Snowflake
Load Snowflake tables and query results: choosing tables, query tables, read windows around now, and where unloaded files go.
A Snowflake source loads tables and views of one database, and the results of queries you write.
Snowflake unloads each read as Parquet with COPY INTO, and SQLLoad reads the files and loads
them into the source’s target. Some targets read the files, or the rows, themselves; see
Where the files go.
[connections.warehouse]kind = "snowflake"account = "myorg-myaccount"user = "loader"auth = { method = "pat", token = "${ENV:SNOWFLAKE_TOKEN}" }warehouse = "LOAD_WH"database = "ANALYTICS"
[sources.shop]kind = "snowflake"connection = "warehouse"description = "Order tables of the shop's warehouse."include = ["SHOP.ORDERS"]write_strategy = "replace"
[sources.shop.tables."SHOP.ORDERS"]description = "Orders, one row per order."cursor_column = "order_date"write_strategy = "delete_insert"lookback = "7d"lookahead = "7d"lookback_from = "now"
[sources.shop.tables.big_orders]description = "Orders of 500 or more."sql = """SELECT ORDER_ID, CUSTOMER_ID, PLACED_AT, TOTALFROM SHOP.ORDERS WHERE TOTAL >= 500"""A connection that only a source reads needs no load_method. A cursor filters the query Snowflake
unloads, so only the rows in the read window leave Snowflake; lookback_from = "now" with
lookahead, as above, reads a fixed window around the time of the run (see
Reload a window).
$ sqlload plan -v…Loads (2) sqlload load├── raw.shop__big_orders replace│ ├── source snowflake shop query big_orders│ ├── route read as Arrow -> DuckDB takes Arrow│ …└── raw.shop__orders delete_insert (cursor: order_date) ├── source snowflake shop SHOP.ORDERS ├── route unload Parquet to internal stage @~/sqlload_unload/ -> download unchanged to a local temporary folder -> DuckDB reads them (nothing through the loader) ├── reads order_date from 2026-11-01 (now minus lookback 7days), below 2026-11-16 (now plus lookahead 7days) └── …Choosing tables
Section titled “Choosing tables”include and exclude are SCHEMA.TABLE patterns of the connection’s database, matched without
regard to case; views match too. Write a table entry’s key as Snowflake stores the name, normally
in upper case, such as [sources.shop.tables."SHOP.ORDERS"]. Unquoted names load in lower case
(ORDER_ID as order_id); a quoted name such as "OrderId" loads as written.
Query tables, where (in Snowflake SQL) and column settings work as for every database source; see
Sources.
Where the files go
Section titled “Where the files go”stage |
Snowflake writes to | SQLLoad reads with |
|---|---|---|
| Omitted | A folder of your user stage, @~/sqlload_unload/ |
The temporary credentials Snowflake hands out |
{ url = "s3://example-bucket/unload/", storage_integration = "S3_UNLOAD", region = "eu-west-2" } |
That S3 folder, through the storage integration | Its AWS credentials, found as for an s3 connection |
{ name = "ANALYTICS.SHOP.UNLOAD_STAGE" } |
That stage, internal or external on S3 | As for the rows above |
- The user stage and other internal stages work on Snowflake accounts hosted on AWS. A named
internal stage must use Snowflake’s default client-side encryption; one created with
ENCRYPTION = (TYPE = 'SNOWFLAKE_SSE')is refused when the table loads. - Each read unloads into a folder of its own, removed after the read, even a failed one. A killed
run can leave it behind; remove it with
REMOVE, or a lifecycle rule on the bucket. - With an external stage, SQLLoad needs to list, read and delete objects under the folder, and the storage integration must let Snowflake write there.
Where the target reads the files itself, no rows pass through SQLLoad, and plan shows it in the
route. Whoever reads the files, a load fails before it commits when they hold a different number
of rows than COPY INTO reports. A table with a mask or checks goes through SQLLoad, and plan
says why.
DuckDB reads the files itself
Section titled “DuckDB reads the files itself”- From an S3 stage given by
url, DuckDB reads the files with the same S3 credentials as SQLLoad. A table without a cursor commits once per run rather than about every 1 GB. - Without a stage, SQLLoad downloads the files unchanged into a
sqlload-unload-…folder in the system’s temporary directory (TMPDIR), and DuckDB reads them there. It needs room for one read’s files (the whole table, or onebatch_sizewindow) per table loading at once, up toconcurrency; on tmpfs, they take memory.
route unload Parquet to s3://example-bucket/unload/ -> DuckDB reads them (nothing through the loader)A stage given by name is read by SQLLoad.
Databricks and ClickHouse read the files themselves
Section titled “Databricks and ClickHouse read the files themselves”From a stage given by url:
- Databricks
COPYs the files through the Unity Catalog external location that covers theurl, as for Parquet files in S3. Aurlno external location covers failsplanwith the fix. - ClickHouse reads each file with
s3(), signed with the same S3 credentials as SQLLoad.
route unload Parquet to s3://example-bucket/unload/ -> Databricks COPY INTO (nothing through the loader)route unload Parquet to s3://example-bucket/unload/ -> ClickHouse reads them (nothing through the loader)A table with a TIME column goes through SQLLoad, since neither stores a time of day as a time.
Snowflake loads the rows itself
Section titled “Snowflake loads the rows itself”Into a Snowflake target, no rows pass through SQLLoad in two cases:
- The target writes through the source’s connection: the same
connection, with no otherdatabase, and the source sets nowarehouseof its own. Snowflake selects the rows with oneINSERT ... SELECTon the connection’s warehouse, and nothing is unloaded. - The source’s
stageurlis inside the target’s external stageurl, on another connection or account. The targetCOPYs the files through its own stage. Anappendstraight into its table fails, before loading anything, when one read unloads too many files for oneCOPY(thousands); a smallerbatch_sizesplits the read.
route Snowflake INSERT ... SELECT on the source's connection (nothing through the loader)route unload Parquet to s3://example-bucket/stage/unload/ -> Snowflake COPY (nothing through the loader)Permissions
Section titled “Permissions”The role needs USAGE on the warehouse, database and schemas, and SELECT on the tables and
views. An external stage given by url also needs USAGE on the storage integration; one given by
name needs USAGE on the stage, or READ and WRITE on an internal one.
| Snowflake | Loads as |
|---|---|
NUMBER(p,0), p up to 18 |
int |
NUMBER(p,s) otherwise, including INTEGER (NUMBER(38,0)) |
decimal(p,s) |
FLOAT |
float |
VARCHAR(n); default length |
varchar(n); text |
BOOLEAN, DATE, TIME, BINARY |
bool, date, time, binary |
TIMESTAMP_NTZ |
timestamp_ntz |
TIMESTAMP_TZ, TIMESTAMP_LTZ |
timestamp_tz, the instant in UTC |
VARIANT, OBJECT, ARRAY |
json |
Times and timestamps keep their microseconds, on every route. Other types, such as GEOGRAPHY,
need a pinned type, such as columns = { area = "text" }. Pin int on an INTEGER column whose
values fit 64 bits. See Types.