Export results to file
Run one SQL statement and write all of its rows to a file (CSV, tab-separated, JSON lines or Parquet), optionally compressed, without holding them all in memory.
Command in the Snowflake toolkit · id ooa.snowflake/export_results · 15 inputs (2 required), 3 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Account address (URL) | String | No | Your Snowflake account address, e.g. https://myorg-myaccount.snowflakecomputing.com. | |
| SQL statement | String | Yes | SQL to run. Put ? where each binding value goes. | |
| File | File | Yes | File to write; add .gz yourself when compressing. | |
| Bindings | List | No | Values for the ? placeholders, in order, e.g. ["2026-10-01"]. | |
| Format | String | No | csv | csv (comma-separated, quoted where needed), tsv (tab-separated), json_lines (one JSON object per row) or parquet (columnar, typed; G6). |
| First row is the header | Boolean | No | true | Write the column names as the first line. |
| Compression | String | No | none | none, or gzip to compress the file. For parquet: auto or snappy (snappy inside the file), gzip, or none. Auto on the other formats compresses with gzip when the file name ends with .gz (G6). |
| Overwrite | Boolean | No | false | Replace a file that already exists. |
| Warehouse | String | No | Warehouse that runs the query. Leave empty for the user's default warehouse. | |
| Database | String | No | Database to use for names that are not fully written out. | |
| Schema | String | No | Schema to use for names that are not fully written out. | |
| Role | String | No | Role to run as. Leave empty for the user's default role. | |
| Wait (seconds) | Number | No | 3000 | How long to wait for the statement to finish. |
| Token | Credential | No | Access token from the vault: an OAuth token, a key-pair JWT or a programmatic access token. Or leave it empty and choose a connection that signs in, which gets and renews the token. | |
| Token type | String | No | OAUTH | Kind of token in the vault: OAUTH, KEYPAIR_JWT or PROGRAMMATIC_ACCESS_TOKEN. |
Outputs
| Output | Type | What it is |
|---|---|---|
| file | File | The file written. |
| row_count | Number | Rows written (not counting the header). |
| statement_handle | String | Id of the statement. |