Daily Edition Sources +5

API Discovery: Keep the Query Handle, Not the Connection

Snowflake’s SQL API gives unfinished work a receipt. Save it, check it later, and keep “accepted” separate from “results ready.”

Four cards show SQL submission, a pending statement handle, repeated status checks and result retrieval, with role grants still applying.
Diagram Punkretain the query handle and implement the recovery loop; database grants still govern the work.
repo mastra-ai/mastra evidence
5 source signals 1 repo commit 99b94b8
Evidence: commit 99b94b8 / September 17, 2026 / Daily Edition
Open Edition Evidence below

Mastra’s September 16 Snowflake integration adds tools for submitting statements, checking them, fetching results and cancelling work. The useful discovery underneath is Snowflake’s existing HTTP lifecycle: a query can outlast the request that submitted it.

The provider’s submission guide accepts SQL at POST /api/v2/statements, with async=true available as a query parameter. Even without that option, clients must handle asynchronous responses. A 202 response supplies a statement handle; later requests can check that same statement.

A practical example: a report that survives a pause

Build a small data-quality assistant for a disposable warehouse. It submits a bounded, read-only count of missing values in a fixture table, stores the returned handle with its job record, and can check the result after its own process restarts. The application must save that record; the API does not persist the agent’s memory for it.

A status request uses GET /api/v2/statements/{statementHandle}. Pending responses need another check; successful execution returns results. Larger results can span partitions described by resultSetMetaData.partitionInfo. A successful first response should not be mistaken for the complete dataset.

Copyable agent instruction

Build a Snowflake SQL API demo against a disposable account fixture.
Use credentials supplied through the environment, never printed.
Use a role granted only the fixture reads and warehouse access it needs.
Start with SELECT 1 and then a bounded aggregate on an approved fixture.
Submit once with async=true. Persist statementHandle in a local job record.
On restart, resume GET status checks for that handle; do not resubmit it.
Distinguish pending, failed and completed states. Back off while pending
or throttled, and stop polling at a bounded deadline without claiming
that stopping the client cancelled the server query.
On success, inspect partitionInfo and fetch every required partition.
Demonstrate restart recovery with a saved pending job and mocked responses
before trying the authenticated service. Report which parts ran live.

Access and test caveat

This is a documented design example, not a live Snowflake test. It needs an account, authentication, appropriate role grants and warehouse access; executing queries can consume warehouse resources. The API reference is the contract for request fields and responses. A read-only prompt is not a database permission boundary.

Mastra’s inspected execution tool accepts arbitrary SQL and optional role and bindings, but does not expose the API’s async query option. Its status and result tools are separate calls; the source does not make the whole recovery loop automatic. Our example therefore targets the provider API directly. Before relying on a wrapper, verify its installed version and exercise a pending query. The receipt is useful only if the application knows what to do when the answer has not arrived.

Evidence Trail

Receipts below the story

The article above is the public narrative. This section keeps the source trail and limits on the same page.

Edition
DateSeptember 17, 2026
LaneDaily Edition
Confidence78%
Sources5
Reposmastra-ai/mastra

Primary Evidence

Evidence Limits

  • Source and documentation inspection only; no authenticated Snowflake test. Account credentials, role grants, warehouse access and possible query costs apply. Applications must persist handles and implement recovery. Stopping polling does not cancel server work. Mastra source is not installed-package verification or automatic polling.
Letters & Corrections

Send a note to the desk

Corrections, missing context, or a follow-up lead.