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

> ## Agent Instructions
> Cognite Data Fusion (CDF) is an industrial DataOps platform. Prefer English docs unless the user asks for another locale.
> Follow /_llms/ index links recursively until you reach page URLs ending in .md. Fetch those Markdown twins instead of HTML.
> For REST APIs, default to calendar version 20230101 (stable). Use 20230101-beta or 20230101-alpha only if the user is on a preview API. Cite paths under /api-reference/concepts/<version>/ and the Cdf-Version header. Prefer the Python SDK (cognite-sdk) unless the user is in JavaScript/TypeScript.
> Start here by task: platform overview /cdf/index.md; data modeling /cdf/dm/index.md; data integration /cdf/integration/index.md; access /cdf/access/index.md; CDF Toolkit /cdf/deploy/cdf_toolkit/index.md; REST quickstart /dev/quickstart.md; Python SDK https://cognite-sdk-python.readthedocs-hosted.com/en/stable/; Atlas AI /cdf/atlas_ai/index.md; plan an Atlas AI agent /cdf/atlas_ai/concepts/atlas_ai_agent_planning.md; Flows apps /cdf/flows/index.md; MCP and IDE setup /dev/guides/ide_ai_integration.md.
> For implementation work, also load /skill.md.

# Read Snowflake data in transformations

> Query Snowflake tables with ext_snowflake in Transformations SQL and write results to CDF destinations.

> [!WARNING]
>
> The features described in this article are in [public preview](https://docs.cognite.com/cdf/product_feature_status.md#public-preview) and may change.

After you [register a Snowflake external data source](https://docs.cognite.com/cdf/integration/guides/transformation/set_up_snowflake_connection.md), reference it in transformation SQL with `ext_snowflake`, then write results to a destination in Cognite Data Fusion (CDF).

## Write the SQL

Reference the source by `externalId`:

```sql theme={"languages":{"custom":["/_languages/kuiper.json"]}}
SELECT *
FROM ext_snowflake('snowflake-sales-prod', 'SALES_DB', 'PUBLIC', 'EQUIPMENT')
```

| Rule | Detail |
| - | - |
| Argument order | Connection `externalId`, database, schema, and table, in that order |
| Literals only | Each argument must be a non-empty single-quoted string literal |
| Four arguments | Any other arity is an error |
| Simple names | Database, schema, and table use letters, digits, and underscores |
| Case | Snowflake uppercases unquoted names. Pass the uppercase name and check column case |
| Read-only | Use `ext_snowflake` only as a `SELECT` source |

For a data model destination, map columns to view properties and include `externalId`:

```sql theme={"languages":{"custom":["/_languages/kuiper.json"]}}
SELECT
  EQUIPMENT_ID                  AS externalId,
  EQUIPMENT_NAME                AS name,
  CAST(COMMISSIONED_ON AS DATE) AS commissionedDate,
  MANUFACTURER                  AS manufacturer
FROM ext_snowflake('snowflake-sales-prod', 'SALES_DB', 'PUBLIC', 'EQUIPMENT')
```

> [!TIP]
>
> Prefer a data model destination. Writing the result to CDF RAW adds the staging copy this path is meant to skip.

## Incremental loads with is\_new

By default, each run reads the full table. Incremental loads need a `TIMESTAMP` or epoch-millisecond `LONG` column that your pipeline updates when a row changes. Snowflake does not create or update that column. You must populate it on every insert and update, then pass it to `is_new()`. CDF stores the high-water mark; the first run processes all rows.

```sql theme={"languages":{"custom":["/_languages/kuiper.json"]}}
SELECT
  EQUIPMENT_ID   AS externalId,
  EQUIPMENT_NAME AS name,
  MANUFACTURER   AS manufacturer
FROM ext_snowflake('snowflake-sales-prod', 'SALES_DB', 'PUBLIC', 'EQUIPMENT') a
WHERE is_new('equipment_cursor', a.LAST_UPDATED_TIME)
```

| Argument | Detail |
| - | - |
| Cursor name | Stable string, unique within the transformation. Use the same name on every run |
| Version column | A column reference, for example `a.LAST_UPDATED_TIME`. The table alias alone is rejected |

| Run | What happens |
| - | - |
| First run | No watermark exists, so all rows are processed |
| Later runs | Only rows newer than the previous watermark are returned |
| Preview | The query is validated. The watermark does not advance |

> [!WARNING]
>
> Passing the table alias as the second argument — `is_new('cursor', a)` — is rejected for Snowflake. That alias form is for data modeling sources (`cdf_nodes`, `cdf_edges`, `cdf_data_models`). Always pass a column for Snowflake.

Deleted rows are not returned, and CDF does not remove the matching instances. For general `is_new` patterns, see [SQL patterns and best practices](https://docs.cognite.com/cdf/integration/guides/transformation/sql_patterns.md).

## Create and run the transformation

Create a transformation with a data model destination (example):

```bash theme={"languages":{"custom":["/_languages/kuiper.json"]}}
curl -sS -X POST "${CDF_BASE}/transformations" \
  -H "Authorization: Bearer ${CDF_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "externalId": "snowflake-equipment-to-dm",
        "name": "Snowflake equipment to data model",
        "query": "SELECT EQUIPMENT_ID AS externalId, EQUIPMENT_NAME AS name FROM ext_snowflake('\''snowflake-sales-prod'\'', '\''SALES_DB'\'', '\''PUBLIC'\'', '\''EQUIPMENT'\'')",
        "destination": {
          "type": "nodes",
          "view": {
            "space": "my-model-space",
            "externalId": "Equipment",
            "version": "v1"
          },
          "instanceSpace": "my-instance-space"
        },
        "conflictMode": "upsert",
        "ignoreNullFields": true,
        "isPublic": true
      }
    ]
  }'
```

| Destination type | Use when |
| - | - |
| `nodes` | Instances of a single view |
| `edges` | Relationships between instances |
| `instances` | A data model type via `dataModel` |

Bind session nonces and run the transformation as you do for other Transformations jobs. See [Create a transformation](https://docs.cognite.com/cdf/integration/guides/transformation/transformations.md).

## Next steps

* [Monitor Snowflake transformations](https://docs.cognite.com/cdf/integration/guides/transformation/monitor_snowflake.md)
* [Troubleshoot Snowflake in Transformations](https://docs.cognite.com/cdf/integration/guides/transformation/troubleshoot_snowflake.md)
