> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Snowflake relation source

> Observe a Snowflake table with its SQL API.

Pass `snowflakeRelation("https://account.snowflakecomputing.com", login)` as `provider` in the [SQL mount example](https://docs.bijection.com/integrations/native-sql.md#mount-and-bind).
Mount once per source relation. Rows and positions use the SQL mount’s label.

Seal this JSON with `bijection secret set`. Use a programmatic access token
for a role with read access to the selected table and usage on the named
warehouse, database and schema. Use the actual case of quoted SQL identifiers.

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "token": "<Snowflake programmatic access token>",
  "path": ["INVENTORY", "PUBLIC", "ITEMS"],
  "key": [{"column": "REGION", "kind": "text"}, {"column": "ID", "kind": "bigint"}],
  "columns": ["ID", "NAME", "QUANTITY"],
  "incarnation": "inventory-items-1",
  "settings": {
    "kind": "snowflake",
    "warehouse": "CONNECTOR_WH",
    "role": "INVENTORY_READER"
  }
}
```

Declare one to eight `VARCHAR` or scale-zero numeric key columns. Use
the `bigint` kind for values that fit a signed 64-bit integer. Maintain a
unique, non-null tuple at the source. Paging compares the full tuple with
text in UTF-8 byte order. Record keys are JSON arrays of strings up to
512 encoded bytes. Each SQL API statement reads one snapshot and must
return one result partition. The connector binds the key continuation,
requests a 20-second statement timeout, and accepts up to 32 rows per
published page, 24 KiB of JSON per row and 48 KiB of encoded records.
Statements and follow-up reads use the same reviewed account origin.

Later traversals refresh observed keys and keep keys that disappear. Change
the configured incarnation when replacing or restoring the relation, and
authorize a reset at the health revision and gap instant.

## Stream changes

Bind `snowflakeStream("https://account.snowflakecomputing.com", login)`
to a fresh mount. Pass the mount's `data` label as the final argument for
protected records. In the sealed connection JSON, use the same table path, columns and
incarnation as above. Use a string `"key": "ID"` for a single signed 64-bit
key and set `settings` to:

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "kind": "snowflakeStream",
  "warehouse": "CONNECTOR_WH",
  "role": "INVENTORY_READER",
  "stream": "ITEMS_CHANGES"
}
```

Create a dedicated standard stream on the base table in the same database
and schema. Disable initial rows and do not move or recreate the stream
until the mount has published its first cursor. Give the token role
`SELECT` on the stream and underlying table and `USAGE` on the database,
schema and warehouse. Maintain Time Travel and change tracking for the
expected polling lag.

The first window starts at the provider's stream offset. Bijection reads
`CHANGES` with an explicit end marker and retains that marker in
millisecond precision. Subsequent windows start at the retained marker.
This read-only mode issues no DML and leaves the Snowflake stream offset
alone. A fresh mount starts empty. Each complete window publishes one
result per affected signed 64-bit key, taking the row image or deletion
from the table version at the window end. Updates to the key can remove
the old key and add the new one. The standard stream's net change semantics
can cancel intermediate writes and combine multiple source commits.

The driver tries windows up to 60 seconds wide. It can narrow a dense
window before publishing, and requests a new page for the remaining range.
A window must fit 32 affected keys and the encoded result budget. Exhausting
the bounded attempts leaves the cursor at its preceding position.
On Time Travel loss or changed table identity, health records a
continuity gap. Install a fresh mount and provision a new stream
offset to resume. The connector does not infer a retention floor from
the configured retention period.

[Snowflake streams](https://docs.snowflake.com/en/user-guide/streams-intro),
[Snowflake CHANGES](https://docs.snowflake.com/en/sql-reference/constructs/changes).

## Write a declared relation

Follow the [parameterized SQL write guide](https://docs.bijection.com/integrations/native-sql.md#parameterized-sql-writes)
for the writer binding, composite and text keys, declared projection and
provider affected-row evidence.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.