Snowflake's API Won't Hand You Rows — It Hands You a Handle
Submitting SQL to Snowflake does not return rows. It returns a statement handle, even for a query with a typo. The video explains polling to a terminal state, fetching partitioned results, and why a finished handle can still mean failure.
Someone submits SQL to Snowflake and expects the answer to come straight back. It does not. The first thing returned is only a handle to check later. This video walks through what Claude has to do with that handle when it uses the snowflake-api skill, and the single habit that governs every query it runs.
Submit returns a handle, not rows
Send a query to Snowflake's SQL API and the first response is a statement handle. It is not rows and it is not an error. Submit SQL with a typo and the API still hands back a handle just the same. Only polling that handle afterward reveals that the statement failed. The failure never shows up in the response to the call that submitted it.
Pick a warehouse first
Before any query runs, Claude needs a warehouse to run it on, which is compute chosen from what is browsable: warehouses, databases, schemas, and tables. Once one is chosen, Claude can submit the real question, such as which tables are in a given schema. The SQL API hands back exactly one thing again, a statement handle, and not the table list.
Poll, then fetch in partitions
The next step is to poll that same handle until it reaches a terminal state, and then fetch the result. The result can arrive in more than one partition, so a single fetch is not always the whole answer. For a long table list, the right expectation is that the list comes in pieces.
A terminal state is not proof of success
Reaching a terminal state does not mean the query succeeded. That same status can read failed instead, and only the poll ever shows it, never the original submit. A handle that still shows as running is not stuck either. That is what polling is for, and it is also what you would cancel if you needed to stop the statement early.
The habit that carries over
The video compresses everything into one habit: treat the submit call as a receipt, not an answer. Poll the handle to a terminal state, then fetch the result one partition at a time. Get that right, and a response from the SQL API stops being misleading.
Key takeaways
- The first response to a submitted query is a statement handle, not rows.
- A query with a typo is still accepted, and the failure appears only when you poll.
- Claude needs a warehouse chosen before it can run anything.
- Poll the handle until it reaches a terminal state, then fetch the result.
- Results can come in more than one partition, so one fetch may be incomplete.
- A terminal state can mean failed as well as succeeded.
- A handle still showing as running is not stuck, and it can be cancelled.
Try it yourself
Ask Claude: "List the tables in a schema I have access to in Snowflake." Then watch three things. Does it treat the first response as a handle to check rather than a finished answer? Does it poll that handle to a terminal state before trusting it? And does it fetch more than one partition if the table list is long?
Chapters
Full transcript(auto-generated, with timestamps)
I submit SQL to Snowflake and get my answer back. Right?
[0:00]Someone submits SQL to Snowflake and expects their answer to come straight back. It doesn't. The first thing back is only a handle to check later. So, what actually comes back first? Submit a
Submit returns a handle, not rows
[0:10]Query to Snowflake's SQL API and the first response back is a statement handle. Not rows, not an error, just a handle to check later. Submit SQL with a typo and the API still hands back a handle just the same. Only polling that handle afterward reveals the statement failed. The failure never shows up in the response to the call that submitted it. Before any query
Warehouse, then submit
[0:31]Runs, Claude needs a warehouse to run it on, compute picked from what's browsable. Warehouses, databases, schemas, and tables. Choose one, then submit the real question, what tables are in this schema? And the SQL API hands back exactly one thing, a statement handle. Not the table list, just a handle to check later. Poll that same handle until it reaches a terminal state, then fetch the result, but it can arrive in more than one partition. So, one fetch isn't always
Terminal isn't proof it succeeded
[0:56]The whole answer. Reaching a terminal state isn't proof the query succeeded, either. That same status can read failed instead, and only the poll ever shows it, never the original submit. A handle still shown as running isn't stuck. That's what polling is for, and it's also what you'd cancel if you needed to stop it early. The habit that carries past this one question, expect the table list in partitions, and check status before you trust any of them. Every Snowflake query Claude runs turns on one habit, treat the submit call as a receipt, not an answer. Poll the handle to a terminal state, then fetch the result one partition at a time. Get that right, and a response from the SQL API
Carry-out
[1:33]Stops meaning anything it doesn't. Your turn. Here's the prompt, read it with me. List the tables in a schema I have access to in Snowflake. Watch three things. Does it treat the first response as a handle to check, not a finished answer? Does it poll that handle to a terminal state before trusting it? And does it fetch more than one partition if
Your turn
[1:49]The table list is long? Lay 'em in for bear. Claude Snowflake API, lay 'em in for bear.
More from Claude
2:45The 402-Line Prompt: How Splitting Agents Makes Them 5x Faster
2:44Sentry API: The ID in the URL Isn't the ID Claude Sends
1:25What's Actually in a Claude Skill? A One-Sentence Answer
2:05Salesforce API: Empty Responses Mean Success, Not Failure
1:42Notification Templates: Fill Them, Don't Write Them
2:07