Snowflake

Run SQL queries against Snowflake data warehouses.

Data and storageCredentials form14 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (14)
  4. runQuery
  5. create_dynamic_table
  6. delete_row
  7. execute_stored_procedure
  8. get_row_by_id
  9. get_table_schema
  10. insert_multiple_rows
  11. insert-row
  12. list_tables
  13. load_data_from_stage
  14. runMultipleQueries
  15. search_rows
  16. update_row
  17. upsert_row
  18. Details

Connect

Auth type: Credentials form (custom_auth). Pass the fields the provider needs (listed below) as the connection's credentials. They are sealed at rest.

FieldTypeDescription
accountrequiredtextSnowflake account identifier (e.g. xy12345.us-east-1)
usernamerequiredtextSnowflake login username
passwordrequiredsecretSnowflake login password
databaserequiredtextDefault database to use
warehouserequiredtextCompute warehouse to use
  • From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
  • Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
  • Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.

Call it from a workflow

step.ctx.integrations.invoke("snowflake", action, input) resolves with the provider's answer and rejects when Snowflake isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. Its actions run through the integration runner, which the server's operator turns on: integrations {action: "catalog", piece: "snowflake"} says whether yours can call it.

Workflow
// workflows/notify.ts: call Snowflake when a booking is confirmed
import { on } from "@appbricx/workflows";

export const tellSnowflake = on.transition("booking", "status", "confirmed", async (_event, step) => {
  // Recorded once: a retry doesn't send it twice. Rejects when Snowflake isn't connected.
  const output = await step.run("Snowflake", () =>
    step.ctx.integrations.invoke("snowflake", "runQuery", {
      "sqlText": "<sql query>"
    }),
  );
  step.ctx.log("Snowflake answered", output);
});
Try it from your agent
{
  "name": "integrations",
  "arguments": {
    "project_id": "<project-id>",
    "action": "call",
    "piece": "snowflake",
    "piece_action": "runQuery",
    "input": {
      "sqlText": "<sql query>"
    },
    "env": "dev"
  }
}
From another backend (connector proxy)
curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/snowflake/runQuery" \
  -H "Authorization: Bearer $APP_KEY" \
  -H "content-type: application/json" \
  -d '{"props":{"sqlText":"<sql query>"}}'

Actions

runQuery

Run Query. Execute a SQL query against your Snowflake database and return the results as rows.

Also accepted as run_query.

InputTypeDescription
sqlTextrequiredlong textThe SQL statement to execute. Use `:1`, `:2`… or `?` as placeholders for the **Parameters** values below to safely pass dynamic values without SQL injection risk.
bindsoptionalarrayValues to bind to the placeholders (`:1`, `:2`…, or `?`) in the SQL query. Provide them in the same order they appear in the query. Using parameters is the safe way to pass dynamic values — never con…
timeoutoptionalnumberMaximum time in milliseconds to wait for the query to complete before cancelling it. Defaults to 30 000 ms (30 seconds).
applicationoptionaltextAn optional label sent to Snowflake to identify this client. Visible in query history under **Monitoring → Query History → Client Application**. Useful for auditing which automation triggered a query.

create_dynamic_table

Create / Refresh Dynamic Table. Create or replace a Snowflake Dynamic Table that automatically refreshes based on a query. Dynamic Tables are a declarative way to define a table whose content is derived from a query, updated on a schedule.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
table_namerequiredtextThe name for the new dynamic table (e.g. `DAILY_SALES_SUMMARY`). Only letters, digits, underscores, and `$` are allowed.
target_lagrequiredtextHow up-to-date the dynamic table data should be (called **Target Lag** in Snowflake). Examples: `1 minute`, `5 minutes`, `1 hour`. Use `DOWNSTREAM` to only refresh when a downstream object explicitly…
warehouseoptionalid (picked from your account)Select the virtual warehouse to use for this operation. Warehouses are listed under **Admin → Warehouses** in the Snowflake console. Leave empty to use the warehouse set in your connection.
queryrequiredlong textThe SELECT statement that defines the content of the dynamic table. Example: `SELECT user_id, SUM(amount) AS total FROM orders GROUP BY user_id`

delete_row

Delete Row. Delete one or more rows from a Snowflake table that match a WHERE condition.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.
where_clauserequiredtextA SQL condition to filter which rows to delete (e.g. `id = 42` or `status = 'archived'`). This field is required to prevent accidental deletion of all rows. **Security note:** this value is embedded …

execute_stored_procedure

Execute Stored Procedure. Call a stored procedure in Snowflake and return its result.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
procedure_namerequiredid (picked from your account)Select the stored procedure to call.
argumentsoptionalarrayPositional arguments to pass to the stored procedure in order. Leave empty if the procedure takes no arguments.

get_row_by_id

Get Row by ID. Retrieve a single row from a Snowflake table by matching a column value.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.
id_columnrequiredid (picked from your account)The column to search in (e.g. the primary key or unique identifier column).
id_valuerequiredtextThe value to look up in the ID column.

get_table_schema

Get Table Schema. Retrieve the column definitions (name, data type, nullability, default) for a Snowflake table.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.

insert_multiple_rows

Insert Multiple Rows. Insert multiple rows into a Snowflake table in a single operation.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.
rowsrequiredarrayOne item per row. Each item must be a JSON object with column names as keys. Example: `{"name": "Alice", "age": 30}`. When mapping from a previous step, pass the entire array directly.

insert-row

Insert Row. Insert a row into a table.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.
table_column_valuesrequiredobject (depends on other props)Enter the value for each column in the new row.

list_tables

List Tables. List all tables in a Snowflake schema.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.

load_data_from_stage

Load Data from Stage. Load data into a Snowflake table from a named internal or external stage using COPY INTO.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.
stage_pathrequiredtextPath to the Snowflake stage (a staging area that holds files before loading). For **internal stages**: use `@stage_name` or `@schema.stage_name/folder/`. For **external stages** (S3, GCS, Azure): use…
file_format_typerequiredone of "CSV" | "JSON" | "PARQUET" | "AVRO" | "ORC" | "XML"The file format of the data files in the stage.
file_patternoptionaltextOptional regular expression to load only files whose names match the pattern (e.g. `.*\.csv` loads only `.csv` files, `sales_2024.*` loads files that start with `sales_2024`). Leave empty to load all…
skip_headeroptionalnumberNumber of rows to skip at the top of each CSV file (e.g. `1` to skip a column-header row). Only applies to CSV files. Defaults to 0.
error_on_column_count_mismatchoptionalbooleanWhen enabled, the load fails if the number of columns in a file does not match the number of columns in the target table. Disable to allow files with fewer columns.
on_erroroptionalone of "ABORT_STATEMENT" | "CONTINUE" | "SKIP_FILE"What to do when a row fails validation during loading.

runMultipleQueries

Run Multiple Queries. Execute multiple SQL statements in sequence against your Snowflake database. Optionally wrap them in a transaction so all changes are rolled back if any statement fails.

InputTypeDescription
sqlTextsrequiredarrayList of SQL statements to run in order. Use `:1`, `:2`… placeholders to reference shared **Parameters** values. Avoid `?` placeholders when running multiple queries — use numbered placeholders instea…
bindsoptionalarrayValues shared across all queries for the numbered placeholders (`:1`, `:2`…). Provide them in order. Unused parameters are allowed.
useTransactionoptionalbooleanWhen enabled, all queries run inside a single transaction. If any query fails, every preceding change in this batch is rolled back automatically.
timeoutoptionalnumberMaximum time in milliseconds to wait for each query to complete before cancelling it. Defaults to 30 000 ms (30 seconds).
applicationoptionaltextAn optional label sent to Snowflake to identify this client. Visible in query history under **Monitoring → Query History → Client Application**.

search_rows

Search Rows. Search for rows in a Snowflake table using an optional WHERE condition, ordering, and row limit.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.
where_clauseoptionaltextOptional SQL WHERE condition to narrow down results (e.g. `status = 'active' AND age > 18`). Leave empty to return all rows (subject to the row limit). **Security note:** this value is embedded direc…
order_byoptionaltextOptional column(s) to sort results by (SQL ORDER BY clause). Examples: `created_at DESC` sorts newest first; `name ASC, age DESC` sorts by name then age. **Security note:** this value is embedded dir…
limitoptionalnumberMaximum number of rows to return. Defaults to 100.

update_row

Update Row. Update one or more rows in a Snowflake table that match a WHERE condition.

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.
table_update_valuesrequiredobject (depends on other props)Only filled columns will be updated. Leave a column empty to keep its existing value.
where_clauseoptionaltextA SQL condition to filter which rows to update (e.g. `id = 42` or `status = 'active'`). Leave empty to update ALL rows in the table (use with caution). **Security note:** this value is embedded direc…

upsert_row

Upsert Row. Insert a new row or update an existing one if a row with the same match column value already exists (MERGE INTO).

InputTypeDescription
databaserequiredid (picked from your account)Select the Snowflake database to use. Databases are listed under **Data → Databases** in the Snowflake console.
schemarequiredid (picked from your account)Select the schema within the chosen database. Schemas are listed under **Data → Databases → [your database]** in the Snowflake console.
tablerequiredid (picked from your account)Select the table to work with.
match_columnrequiredid (picked from your account)The column used to identify whether a row already exists (e.g. the primary key or a unique identifier column).
table_column_valuesrequiredobject (depends on other props)Enter the value for each column in the new row.

Details

Id
snowflake
Category
Data and storage
Tags
data-warehouse, sql, analytics, cloud
Package
@activepieces/piece-snowflake@0.3.1
Runs
Through the integration runner