You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've run into a problem lately with the terraform-snowflake provider when trying to create a Python UDF using "snowflake_function" resource.
The function I created is a valid python function with proper syntax (works fine outside of terraform). It is this python example here
// Example for Python language resource "snowflake_function" "python_test" { name = "MY_PYTHON_FUNC" database = "MY_DB" schema = "MY_SCHEMA" arguments { name = "arg1" type = "number" } comment = "Example for Python language" return_type = "NUMBER(38,0)" null_input_behavior = "CALLED ON NULL INPUT" return_behavior = "VOLATILE" language = "python" runtime_version = "3.8" handler = "add_py" statement = "def add_py(i): return i+1" }
But when I try to create the same function using terraform I get an error 391528 (42601): SQL compilation error: An active warehouse is required for creating Python UDFs.
What it seems like is happening is Snowflake needs a warehouse to run/create certain functions/resources but it does not need a warehouse for certain things as I can still create SQL functions without providing a default warehouse to the provider connection string and also not having a default warehouse set up for the user being used by the provider to connect to snowflake.
The documentation on snowflake says, we need a warehouse to run any DML
[https://docs.snowflake.com/en/user-guide/warehouses-tasks](Snowflake Documentation)
Here is what the snowflake documentation says
Using a Warehouse
To execute a query or DML statement in Snowflake, a warehouse must be running and it must be specified as the current warehouse for the session in which the query/statement is submitted.
A Snowflake session can only have one current warehouse at a time. The current warehouse for a session can be specified or changed at any time through the USE WAREHOUSE command.
Once a running warehouse has been set as the current warehouse for a session, queries and DML statements submitted within the session are processed by the warehouse. In the History History tab and Worksheets Worksheet tab pages in the Classic Console, you can view the warehouse used to process each query/statement.
The proposal I'm making is we make the warehouse a required field, so all the DMLs terraform provider send to snowflake has a default warehouse and the everything is consistent.
Although I believe Snowflake should fix it and ensure there is a default warehouse on every DML operation. But fixing terraform provider is the best thing to do as of now.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I've run into a problem lately with the terraform-snowflake provider when trying to create a Python UDF using "snowflake_function" resource.
The function I created is a valid python function with proper syntax (works fine outside of terraform). It is this python example here
// Example for Python language resource "snowflake_function" "python_test" { name = "MY_PYTHON_FUNC" database = "MY_DB" schema = "MY_SCHEMA" arguments { name = "arg1" type = "number" } comment = "Example for Python language" return_type = "NUMBER(38,0)" null_input_behavior = "CALLED ON NULL INPUT" return_behavior = "VOLATILE" language = "python" runtime_version = "3.8" handler = "add_py" statement = "def add_py(i): return i+1" }
But when I try to create the same function using terraform I get an error
391528 (42601): SQL compilation error: An active warehouse is required for creating Python UDFs.
What it seems like is happening is Snowflake needs a warehouse to run/create certain functions/resources but it does not need a warehouse for certain things as I can still create SQL functions without providing a default warehouse to the provider connection string and also not having a default warehouse set up for the user being used by the provider to connect to snowflake.
The documentation on snowflake says, we need a warehouse to run any DML
[https://docs.snowflake.com/en/user-guide/warehouses-tasks](Snowflake Documentation)
Here is what the snowflake documentation says
The proposal I'm making is we make the warehouse a required field, so all the DMLs terraform provider send to snowflake has a default warehouse and the everything is consistent.
Although I believe Snowflake should fix it and ensure there is a default warehouse on every DML operation. But fixing terraform provider is the best thing to do as of now.
Beta Was this translation helpful? Give feedback.
All reactions