Best Practices for Writing Form Data to Snowflake Using Retool Workflows

Hi Retool Team,

We’re new to Retool and are exploring workflows for SQL database integrations. I’ve set up a form in Retool that triggers a workflow to insert data into a Snowflake table.

The workflow runs a standard INSERT INTO query, where form inputs are passed dynamically as query parameters. However, I keep encountering a "VARIANT" error during execution, even though the data types in the database are defined correctly and the query works when tested manually in Snowflake.


Details of the Setup:

Database: Snowflake
Fields: Mix of VARCHAR, FLOAT, and TIMESTAMP types.
ID: Auto-incremented (handled in Snowflake).
DATECREATED: Set via CURRENT_TIMESTAMP() in the query.
Issue: Form submissions are passing inputs, but the workflow fails due to an unsupported VARIANT type error.
Note: I have tried submitting a test form with valid values, but the issue persists.


Questions:

  1. Are there known issues with how null or empty form inputs are passed to SQL queries in Retool? I have also tested with actual form submissions and still encounter the error.
  2. What’s the recommended approach for ensuring form inputs align with Snowflake’s required data types?
  3. Any feedback on how workflows that write back to Snowflake databases work best when triggered by forms?
  4. If possible, could you share example workflows or best practices for similar use cases?

We’d greatly appreciate any guidance or troubleshooting steps to resolve this and ensure the workflow functions as intended!

Thank you,
Easton Place

1 Like

+1 very similar question

Hello @easton.place!

Great question, I was just about to embark on a Snowflake deep dive to learn more about the tool and to figure out best practices to better assist users.

From the details of your testing it sounds like this issue could be from Retool's query builder. I have seen some workarounds needed for handling NULL and empty values for other resources.

I will look to reproduce this and see if this is a bug or if there is a methodology to handle different values.

For your use case, which field out of VARCHAR , FLOAT , and TIMESTAMP was giving the VARIANT error? Was it giving you this error for both null values and for empty string inputs?

Also is there a reason from sending the data from a form in the app to a workflow to then pass via query? It might be easier to trigger the query from the form component in the app. But it sounds like you tested that as well and still encountered the VARIANT error :thinking: