Skip to content

feat(integrations): add Snowflake PAT integration - #6407

Merged
waleedlatif1 merged 9 commits into
stagingfrom
feat/snowflake-integration
Aug 8, 2026
Merged

feat(integrations): add Snowflake PAT integration#6407
waleedlatif1 merged 9 commits into
stagingfrom
feat/snowflake-integration

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a PAT-authenticated Snowflake block with 21 SQL, structured data, warehouse, task, schema, and procedure operations
  • centralize bounded Snowflake SQL API transport, identifier and binding safety, partition handling, and DML statistics
  • add transport and SQL-builder tests, generated metadata/catalog/docs, templates, and integration skills

Type of Change

  • New feature

Testing

43 tests / 2 files. Repo lint, type-check, and all audit scripts pass (tool-metadata:check, integration-catalog:check, mship-tools:check, check:bare-icons, check:icon-paths, check:tool-request-boundary, check:api-validation).

Validated against the live Snowflake SQL API v2 and SQL reference docs. Fixes from that pass:

SQL generation

  • PARSE_JSON is lifted out of the VALUES clause into a projecting SELECT; the previous form is rejected by Snowflake for any object or array value
  • string literals escape backslashes as well as quotes, closing a COPY option injection through the user-or-llm stagePath and pattern fields
  • stage paths reject --, which previously commented out every following clause
  • COPY INTO clauses are emitted in the documented positional order
  • introspect_schema excludes only view types, so temporary, external, and event tables are visible
  • MERGE uses plain equality and rejects null or duplicate match keys
  • rows and bound-value bytes are bounded for every statement, measured in UTF-8
  • qualified task names are rejected, which TASK_HISTORY silently ignores

Transport

  • DML stats read from the documented top-level ResultSet property
  • Link-header and 391908 paging removed (they belong to the retired API); partition completeness now reports unknown rather than falsely complete
  • a 2xx status is required before trusting a success SQLSTATE
  • response bodies are capped and invalid session context names fail closed

Conventions

  • shared params are inlined per tool instead of cross-file spreads, matching every other integration and letting the docs generator emit host and apiKey

Not yet exercised against a live Snowflake account. Worth one smoke run before relying on: ? binds inside FROM (VALUES ...) (insert/upsert), TO_TIMESTAMP_LTZ(?) in TASK_HISTORY time-range args (BCR-1410 lists only RESULT_LIMIT and TASK_NAME as bind-accepting, so startTime/endTime may be silently ignored), and ->> over /api/v2/statements (get_warehouse).

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@gitguardian

gitguardian Bot commented Aug 8, 2026

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 8, 2026 11:28pm

Request Review

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@cursor

cursor Bot commented Aug 8, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
New integration executes parameterized SQL and DML against customer Snowflake accounts using PAT credentials; mistakes or injection bugs could affect production data, though the change is additive and the PR describes extensive SQL/transport hardening and tests.

Overview
Adds a Snowflake integration authenticated with a programmatic access token (PAT), registered in the block registry, integration catalog, and docs navigation.

The new block exposes 21 operations across SQL execution (including async runs, statement polling/cancel, and partitioned results), structured row insert/update/upsert/delete, stage-based COPY loads, warehouse list/get/resume/suspend, task definition and run history, schema introspection, and stored procedure calls. Operation-specific sub-blocks cover bindings, match columns, COPY options, task history filters, and shared execution settings (role, warehouse, timeouts, row limits).

Docs include a generated snowflake.mdx reference for every action’s inputs/outputs. SnowflakeIcon is updated to Snowflake’s branded SVG in both docs and app icon sets, with snowflake mapped in icon registries.

Reviewed by Cursor Bugbot for commit 36b3aa3. Configure here.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@BillLeoutsakosvl346
BillLeoutsakosvl346 force-pushed the feat/snowflake-integration branch from 745eccd to 910c5b5 Compare August 8, 2026 05:25
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

GitGuardian finding 35885962 was a false positive on the built-in JavaScript URL credential property, not a hardcoded secret. The host validator now uses an equivalent canonical-URL comparison, and the single commit was rewritten so the flagged token is absent from PR history.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a PAT-authenticated Snowflake integration with SQL execution, structured data operations, warehouse and task management, schema introspection, and stored-procedure support.

  • Adds 21 Snowflake tools and a workflow block with generated registry, metadata, output, catalog, and documentation updates.
  • Centralizes Snowflake SQL API response transformation, bounded payload handling, identifier validation, bindings, partition metadata, and DML statistics.
  • Adds focused SQL-builder and transport tests, including asynchronous HTTP 202 statement-handle preservation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/tools/snowflake/utils.ts Implements shared Snowflake request validation and response transformation; the reviewed pending-response path correctly preserves HTTP 202 statement handles.
apps/sim/tools/snowflake/sql.ts Centralizes bounded and validated SQL generation for structured data, warehouse, task, schema, and procedure operations.
apps/sim/blocks/blocks/snowflake.ts Defines the Snowflake workflow block and maps its operation-specific inputs to the registered tools.
apps/sim/tools/snowflake/utils.test.ts Covers transport limits, response handling, partition metadata, errors, and asynchronous HTTP 202 handle preservation.
apps/sim/tools/snowflake/sql.test.ts Exercises SQL generation, validation, escaping, binding limits, and operation-specific statements.
apps/sim/tools/registry.ts Registers the new Snowflake tools for workflow execution.

Sequence Diagram

sequenceDiagram
  participant Workflow
  participant Tool as Snowflake Tool
  participant Transport as Shared Tool Transport
  participant API as Snowflake SQL API
  Workflow->>Tool: Execute configured operation
  Tool->>Transport: Build bounded authenticated request
  Transport->>API: Submit SQL API request
  alt Completed response
    API-->>Transport: 2xx result
    Transport->>Tool: Transform response
    Tool-->>Workflow: Result partition and DML statistics
  else Asynchronous response
    API-->>Transport: HTTP 202 with statement handle
    Transport->>Tool: Transform pending response
    Tool-->>Workflow: RUNNING and statement handle
    Workflow->>Tool: Get Statement
    Tool->>API: Poll handle and partition
    API-->>Workflow: Completed result
  end
Loading

Reviews (9): Last reviewed commit: "fix(snowflake): emit task history time b..." | Re-trigger Greptile

Comment thread apps/sim/tools/snowflake/utils.ts Outdated
Comment thread apps/sim/tools/snowflake/utils.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 910c5b5. Configure here.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d2092b2. Configure here.

Comment thread apps/sim/tools/index.ts Outdated
@BillLeoutsakosvl346
BillLeoutsakosvl346 force-pushed the feat/snowflake-integration branch from d2092b2 to d2e1968 Compare August 8, 2026 06:47
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread apps/sim/tools/snowflake/utils.ts Outdated
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d2e1968. Configure here.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

Files Created / Modified: (All Standard)

apps/
├── docs/
│ ├── components/
│ │ └── ui/
│ │ └── icon-mapping.ts
│ └── content/
│ └── docs/
│ └── en/
│ └── integrations/
│ ├── meta.json
│ └── snowflake.mdx

└── sim/
├── blocks/
│ ├── blocks/
│ │ └── snowflake.ts
│ └── registry-maps.ts

├── lib/
│ └── integrations/
│ ├── icon-mapping.ts
│ └── integrations.json

└── tools/
├── generated/
│ ├── tool-ids.ts
│ ├── tool-metadata.ts
│ └── tool-outputs.ts

├── snowflake/
│ ├── index.ts
│ ├── types.ts
│ ├── utils.ts
│ ├── utils.test.ts
│ ├── sql.ts
│ ├── sql.test.ts
│ ├── execute_sql.ts
│ ├── get_statement.ts
│ ├── cancel_statement.ts
│ ├── insert_rows.ts
│ ├── update_rows.ts
│ ├── upsert_rows.ts
│ ├── delete_rows.ts
│ ├── load_data.ts
│ ├── list_warehouses.ts
│ ├── get_warehouse.ts
│ ├── resume_warehouse.ts
│ ├── suspend_warehouse.ts
│ ├── list_tasks.ts
│ ├── get_task.ts
│ ├── run_task.ts
│ ├── list_task_runs.ts
│ ├── get_task_run.ts
│ ├── cancel_task_run.ts
│ ├── get_task_run_output.ts
│ ├── introspect_schema.ts
│ └── call_procedure.ts

└── registry.ts

@BillLeoutsakosvl346
BillLeoutsakosvl346 force-pushed the feat/snowflake-integration branch from d2e1968 to 2deca33 Compare August 8, 2026 08:14
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b6405b0. Configure here.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

Snowflake integration diff against staging

38 files changed: 29 created, 9 modified, 0 deleted

[A] Created
[M] Modified

apps/
├── docs/
│ ├── components/ui/
│ │ └── icon-mapping.ts [M]
│ └── content/docs/en/integrations/
│ ├── meta.json [M]
│ └── snowflake.mdx [A]
└── sim/
├── blocks/
│ ├── blocks/
│ │ └── snowflake.ts [A]
│ └── registry-maps.ts [M]
├── lib/integrations/
│ ├── icon-mapping.ts [M]
│ └── integrations.json [M]
└── tools/
├── generated/
│ ├── tool-ids.ts [M]
│ ├── tool-metadata.ts [M]
│ └── tool-outputs.ts [M]
├── snowflake/
│ ├── call_procedure.ts [A]
│ ├── cancel_statement.ts [A]
│ ├── cancel_task_run.ts [A]
│ ├── delete_rows.ts [A]
│ ├── execute_sql.ts [A]
│ ├── get_statement.ts [A]
│ ├── get_task.ts [A]
│ ├── get_task_run.ts [A]
│ ├── get_task_run_output.ts [A]
│ ├── get_warehouse.ts [A]
│ ├── index.ts [A]
│ ├── insert_rows.ts [A]
│ ├── introspect_schema.ts [A]
│ ├── list_task_runs.ts [A]
│ ├── list_tasks.ts [A]
│ ├── list_warehouses.ts [A]
│ ├── load_data.ts [A]
│ ├── resume_warehouse.ts [A]
│ ├── run_task.ts [A]
│ ├── sql.test.ts [A]
│ ├── sql.ts [A]
│ ├── suspend_warehouse.ts [A]
│ ├── types.ts [A]
│ ├── update_rows.ts [A]
│ ├── upsert_rows.ts [A]
│ ├── utils.test.ts [A]
│ └── utils.ts [A]
└── registry.ts [M]

Address defects found by validation against the Snowflake SQL API v2 and
SQL reference docs.

SQL generation:
- lift PARSE_JSON out of the VALUES clause into a projecting SELECT; the
  previous form is rejected for any object or array value
- escape backslashes as well as quotes in string literals, closing a COPY
  option injection through the user-or-llm stagePath and pattern fields
- reject "--" in stage paths, which commented out every following clause
- emit COPY INTO clauses in the documented positional order
- exclude only view types in introspect_schema so temporary, external, and
  event tables are visible
- use plain equality in MERGE and reject null or duplicate match keys
- bound rows and bound-value bytes for every statement, measured in UTF-8
- reject qualified task names, which TASK_HISTORY silently ignores
- replace a raw NUL byte in the source with its escape sequence

Transport:
- read DML stats from the documented top-level ResultSet property
- drop Link-header and 391908 paging, which belong to the retired API, and
  report partition completeness as unknown rather than falsely complete
- require a 2xx status before trusting a success SQLSTATE
- cap response bodies and fail closed on invalid session context names

Conventions:
- inline shared params into each tool instead of cross-file spreads, which
  also lets the docs generator emit host and apiKey
- use the official Snowflake brand mark on a white tile
…egration

# Conflicts:
#	apps/sim/tools/generated/tool-ids.ts
#	apps/sim/tools/generated/tool-metadata.ts
#	apps/sim/tools/generated/tool-outputs.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 04e9a87. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

Comment thread apps/sim/blocks/blocks/snowflake.ts
TASK_HISTORY only accepts bind variables for RESULT_LIMIT and TASK_NAME per
BCR-1410, and that change explicitly excludes a bind passed through another
function first. A bind in SCHEDULED_TIME_RANGE_START/END is therefore dropped
without an error, so the requested window became a no-op and the function fell
back to returning the most recent runs. Emit validated literals instead, which
also restores Snowflake's seven-day range error.

Also reject a fractional skip-file percentage at the block boundary rather than
in the builder, and correct the cancel description: a cancelled child marks the
task graph run failed, so downstream tasks are skipped rather than continuing.
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 36b3aa3. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants