1
votes

we are currently running our first analytics prototype on Snowflake. The objective is to create a comprehensive analysis result table that can be used for reporting based on ~60 structured raw data tables. We created all the necessary SQL scripts using the built-in worksheet functionality. In total we wrote around 80 worksheets, each with 5-10 sql statements. As a next step we would like to automate the execution of these worksheets in a simple, sequential order. However, Tasks and Stored Procedures, both built-in solutions we looked into, fail to execute more than one SQL-statement in a single call.

Multiple SQL statements in a single API call are not supported; use one API call per statement instead.

How are you guys handling this? Do we really have to write individual tasks/stored procedures for every single sql statement? In our case this would easily amass to more than 500 of those.

Very much interested in your input, thanks!

2

2 Answers

0
votes

I think your problem is you're using the wrong tool ;) The worksheets are just not meant for batch processing, if you want to do that you should use the snowsql client:

https://docs.snowflake.com/en/user-guide/snowsql-use.html

0
votes

You cannot use worksheet to create stored procedures. You need to use Javascript API (until SQL stored procedures are made available).

https://docs.snowflake.com/en/sql-reference/stored-procedures-usage.html