Skip to content

Commit c98e449

Browse files
chore: Update docs and migration guide (#3313)
- Update docs and migration guide - Bump tracking version - Fix method usage after merge (method has been removed) - Fix whitespace - Fix link - Improve function and procedure examples (multiline) References: #3303 #3302 #3298
1 parent 0de5733 commit c98e449

File tree

28 files changed

+269
-122
lines changed

28 files changed

+269
-122
lines changed

MIGRATION_GUIDE.md

Lines changed: 93 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -52,61 +52,101 @@ We added non-negative validations for the following parameters:
5252

5353
Note that enum parameters are still not validated by the provider - they are only validated in Snowflake. We will handle this during a small rework of the parameters in the future.
5454

55+
### Add missing preview features to config
56+
57+
Values:
58+
- `snowflake_functions_datasource`
59+
- `snowflake_procedures_datasource`
60+
- `snowflake_tables_datasource`
61+
were missing in the `preview_features_enabled` attribute in the provider's config. They were added.
62+
63+
References: #3302
64+
65+
### functions and procedures docs updated
66+
67+
Argument names are automatically wrapped in double quotes, so:
68+
- uppercase names should be used or
69+
- argument name should be quoted in the procedure/function definition.
70+
71+
Updated the docs and the previous migration guide entry.
72+
73+
References: #3298
74+
75+
### python procedure docs updated
76+
77+
Importing python procedure is currently limited to procedures with snowflake-snowpark-python version explicitly set in Snowflake. Docs were updated.
78+
79+
References: #3303
80+
5581
## v0.100.0 ➞ v1.0.0
5682

5783
### Preview features flag
5884
All of the preview features objects are now disabled by default. This includes:
5985
- Resources
60-
- `snowflake_account_password_policy_attachment`
61-
- `snowflake_alert`
62-
- `snowflake_api_integration`
63-
- `snowflake_cortex_search_service`
64-
- `snowflake_dynamic_table`
65-
- `snowflake_external_function`
66-
- `snowflake_external_table`
67-
- `snowflake_external_volume`
68-
- `snowflake_failover_group`
69-
- `snowflake_file_format`
70-
- `snowflake_managed_account`
71-
- `snowflake_materialized_view`
72-
- `snowflake_network_policy_attachment`
73-
- `snowflake_network_rule`
74-
- `snowflake_email_notification_integration`
75-
- `snowflake_notification_integration`
76-
- `snowflake_object_parameter`
77-
- `snowflake_password_policy`
78-
- `snowflake_pipe`
79-
- `snowflake_sequence`
80-
- `snowflake_share`
81-
- `snowflake_stage`
82-
- `snowflake_storage_integration`
83-
- `snowflake_table_column_masking_policy_application`
84-
- `snowflake_table_constraint`
85-
- `snowflake_user_public_keys`
86-
- `snowflake_user_password_policy_attachment`
86+
- `snowflake_account_password_policy_attachment`
87+
- `snowflake_alert`
88+
- `snowflake_api_integration`
89+
- `snowflake_cortex_search_service`
90+
- `snowflake_dynamic_table`
91+
- `snowflake_external_function`
92+
- `snowflake_external_table`
93+
- `snowflake_external_volume`
94+
- `snowflake_failover_group`
95+
- `snowflake_file_format`
96+
- `snowflake_function_java`
97+
- `snowflake_function_javascript`
98+
- `snowflake_function_python`
99+
- `snowflake_function_scala`
100+
- `snowflake_function_sql`
101+
- `snowflake_managed_account`
102+
- `snowflake_materialized_view`
103+
- `snowflake_network_policy_attachment`
104+
- `snowflake_network_rule`
105+
- `snowflake_email_notification_integration`
106+
- `snowflake_notification_integration`
107+
- `snowflake_object_parameter`
108+
- `snowflake_password_policy`
109+
- `snowflake_pipe`
110+
- `snowflake_procedure_java`
111+
- `snowflake_procedure_javascript`
112+
- `snowflake_procedure_python`
113+
- `snowflake_procedure_scala`
114+
- `snowflake_procedure_sql`
115+
- `snowflake_sequence`
116+
- `snowflake_share`
117+
- `snowflake_stage`
118+
- `snowflake_storage_integration`
119+
- `snowflake_table`
120+
- `snowflake_table_column_masking_policy_application`
121+
- `snowflake_table_constraint`
122+
- `snowflake_user_public_keys`
123+
- `snowflake_user_password_policy_attachment`
87124
- Data sources
88-
- `snowflake_current_account`
89-
- `snowflake_alerts`
90-
- `snowflake_cortex_search_services`
91-
- `snowflake_database`
92-
- `snowflake_database_role`
93-
- `snowflake_dynamic_tables`
94-
- `snowflake_external_functions`
95-
- `snowflake_external_tables`
96-
- `snowflake_failover_groups`
97-
- `snowflake_file_formats`
98-
- `snowflake_materialized_views`
99-
- `snowflake_pipes`
100-
- `snowflake_current_role`
101-
- `snowflake_sequences`
102-
- `snowflake_shares`
103-
- `snowflake_parameters`
104-
- `snowflake_stages`
105-
- `snowflake_storage_integrations`
106-
- `snowflake_system_generate_scim_access_token`
107-
- `snowflake_system_get_aws_sns_iam_policy`
108-
- `snowflake_system_get_privatelink_config`
109-
- `snowflake_system_get_snowflake_platform_info`
125+
- `snowflake_current_account`
126+
- `snowflake_alerts`
127+
- `snowflake_cortex_search_services`
128+
- `snowflake_database`
129+
- `snowflake_database_role`
130+
- `snowflake_dynamic_tables`
131+
- `snowflake_external_functions`
132+
- `snowflake_external_tables`
133+
- `snowflake_failover_groups`
134+
- `snowflake_file_formats`
135+
- `snowflake_functions`
136+
- `snowflake_materialized_views`
137+
- `snowflake_pipes`
138+
- `snowflake_procedures`
139+
- `snowflake_current_role`
140+
- `snowflake_sequences`
141+
- `snowflake_shares`
142+
- `snowflake_parameters`
143+
- `snowflake_stages`
144+
- `snowflake_storage_integrations`
145+
- `snowflake_system_generate_scim_access_token`
146+
- `snowflake_system_get_aws_sns_iam_policy`
147+
- `snowflake_system_get_privatelink_config`
148+
- `snowflake_system_get_snowflake_platform_info`
149+
- `snowflake_tables`
110150

111151
If you want to have them enabled, add the feature name to the provider configuration (with `_datasource` or `_resource` suffix), like this:
112152
```terraform
@@ -170,6 +210,8 @@ The new resources are more aligned with current features like:
170210
- secrets support
171211
- argument default values
172212

213+
**Note**: argument names are now quoted automatically by the provider so remember about this while writing the function definition (argument name should be quoted or uppercase should be used for the argument name).
214+
173215
`snowflake_procedure` is now deprecated in favor of 5 new preview resources:
174216

175217
- `snowflake_procedure_java`
@@ -186,6 +228,8 @@ The new resources are more aligned with current features like:
186228
- secrets support
187229
- argument default values
188230

231+
**Note**: argument names are now quoted automatically by the provider so remember about this while writing the procedure definition (argument name should be quoted or uppercase should be used for the argument name).
232+
189233
### *(new feature)* Account role data source
190234
Added a new `snowflake_account_roles` data source for account roles. Now it reflects It's based on `snowflake_roles` data source.
191235
`account_roles` field now organizes output of show under `show_output` field.

docs/resources/function_java.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ resource "snowflake_function_java" "w" {
4040
}
4141
return_type = "VARCHAR(100)"
4242
handler = "TestFunc.echoVarchar"
43-
function_definition = "\n\tclass TestFunc {\n\t\tpublic static String echoVarchar(String x) {\n\t\t\treturn x;\n\t\t}\n\t}\n"
43+
function_definition = <<EOT
44+
class TestFunc {
45+
public static String echoVarchar(String x) {
46+
return x;
47+
}
48+
}
49+
EOT
4450
}
4551
```
4652
-> **Note** Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult [identifiers guide](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/guides/identifiers#new-computed-fully-qualified-name-field-in-resources).
@@ -90,7 +96,7 @@ resource "snowflake_function_java" "w" {
9096
Required:
9197

9298
- `arg_data_type` (String) The argument type.
93-
- `arg_name` (String) The argument name.
99+
- `arg_name` (String) The argument name. The provider wraps it in double quotes by default, so be aware of that while referencing the argument in the function definition.
94100

95101
Optional:
96102

docs/resources/function_javascript.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@ resource "snowflake_function_javascript" "minimal" {
3939
arg_data_type = "VARIANT"
4040
arg_name = "x"
4141
}
42-
function_definition = <<EOF
43-
return x;
44-
EOF
4542
return_type = "VARIANT"
43+
function_definition = <<EOT
44+
if (x == 0) {
45+
return 1;
46+
} else {
47+
return 2;
48+
}
49+
EOT
4650
}
4751
```
4852
-> **Note** Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult [identifiers guide](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/guides/identifiers#new-computed-fully-qualified-name-field-in-resources).
@@ -85,7 +89,7 @@ resource "snowflake_function_javascript" "minimal" {
8589
Required:
8690

8791
- `arg_data_type` (String) The argument type.
88-
- `arg_name` (String) The argument name.
92+
- `arg_name` (String) The argument name. The provider wraps it in double quotes by default, so be aware of that while referencing the argument in the function definition.
8993

9094
Optional:
9195

docs/resources/function_python.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ resource "snowflake_function_python" "minimal" {
4242
arg_data_type = "NUMBER(36, 2)"
4343
arg_name = "x"
4444
}
45-
function_definition = <<EOF
46-
def some_function(x):
47-
return x
48-
EOF
49-
handler = "some_function"
5045
return_type = "NUMBER(36, 2)"
46+
handler = "some_function"
47+
function_definition = <<EOT
48+
def some_function(x):
49+
result = ''
50+
for a in range(5):
51+
result += x
52+
return result
53+
EOT
5154
}
5255
```
5356
-> **Note** Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult [identifiers guide](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/guides/identifiers#new-computed-fully-qualified-name-field-in-resources).
@@ -97,7 +100,7 @@ resource "snowflake_function_python" "minimal" {
97100
Required:
98101

99102
- `arg_data_type` (String) The argument type.
100-
- `arg_name` (String) The argument name.
103+
- `arg_name` (String) The argument name. The provider wraps it in double quotes by default, so be aware of that while referencing the argument in the function definition.
101104

102105
Optional:
103106

docs/resources/function_scala.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ resource "snowflake_function_scala" "minimal" {
3737
arg_data_type = "VARCHAR(100)"
3838
arg_name = "x"
3939
}
40-
function_definition = <<EOF
40+
return_type = "VARCHAR(100)"
41+
runtime_version = "2.12"
42+
handler = "TestFunc.echoVarchar"
43+
function_definition = <<EOT
4144
class TestFunc {
4245
def echoVarchar(x : String): String = {
4346
return x
4447
}
4548
}
46-
EOF
47-
runtime_version = "2.12"
48-
handler = "TestFunc.echoVarchar"
49-
return_type = "VARCHAR(100)"
49+
EOT
5050
}
5151
5252
# Complete
@@ -61,13 +61,13 @@ resource "snowflake_function_scala" "complete" {
6161
}
6262
comment = "some comment"
6363
external_access_integrations = ["external_access_integration_name", "external_access_integration_name_2"]
64-
function_definition = <<EOF
64+
function_definition = <<EOT
6565
class TestFunc {
6666
def echoVarchar(x : String): String = {
6767
return x
6868
}
6969
}
70-
EOF
70+
EOT
7171
handler = "TestFunc.echoVarchar"
7272
null_input_behavior = "CALLED ON NULL INPUT"
7373
return_results_behavior = "VOLATILE"
@@ -143,7 +143,7 @@ resource "snowflake_function_scala" "complete" {
143143
Required:
144144

145145
- `arg_data_type` (String) The argument type.
146-
- `arg_name` (String) The argument name.
146+
- `arg_name` (String) The argument name. The provider wraps it in double quotes by default, so be aware of that while referencing the argument in the function definition.
147147

148148
Optional:
149149

docs/resources/function_sql.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ resource "snowflake_function_sql" "minimal" {
3939
arg_data_type = "FLOAT"
4040
arg_name = "arg_name"
4141
}
42-
function_definition = <<EOF
43-
arg_name
44-
EOF
4542
return_type = "FLOAT"
43+
function_definition = <<EOT
44+
arg_name
45+
EOT
4646
}
4747
4848
# Complete
@@ -55,10 +55,10 @@ resource "snowflake_function_sql" "complete" {
5555
arg_data_type = "FLOAT"
5656
arg_name = "arg_name"
5757
}
58-
function_definition = <<EOF
59-
arg_name
60-
EOF
6158
return_type = "FLOAT"
59+
function_definition = <<EOT
60+
arg_name
61+
EOT
6262
return_results_behavior = "VOLATILE"
6363
comment = "some comment"
6464
}
@@ -102,7 +102,7 @@ resource "snowflake_function_sql" "complete" {
102102
Required:
103103

104104
- `arg_data_type` (String) The argument type.
105-
- `arg_name` (String) The argument name.
105+
- `arg_name` (String) The argument name. The provider wraps it in double quotes by default, so be aware of that while referencing the argument in the function definition.
106106

107107
Optional:
108108

docs/resources/procedure_java.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ resource "snowflake_procedure_java" "basic" {
4141
}
4242
return_type = "VARCHAR(100)"
4343
handler = "TestFunc.echoVarchar"
44-
procedure_definition = "\n\timport com.snowflake.snowpark_java.*;\n\tclass TestFunc {\n\t\tpublic static String echoVarchar(Session session, String x) {\n\t\t\treturn x;\n\t\t}\n\t}\n"
44+
procedure_definition = <<EOT
45+
import com.snowflake.snowpark_java.*;
46+
class TestFunc {
47+
public static String echoVarchar(Session session, String x) {
48+
return x;
49+
}
50+
}
51+
EOT
4552
runtime_version = "11"
4653
snowpark_package = "1.14.0"
4754
}
@@ -57,7 +64,14 @@ resource "snowflake_procedure_java" "full" {
5764
}
5865
return_type = "VARCHAR(100)"
5966
handler = "TestFunc.echoVarchar"
60-
procedure_definition = "\n\timport com.snowflake.snowpark_java.*;\n\tclass TestFunc {\n\t\tpublic static String echoVarchar(Session session, String x) {\n\t\t\treturn x;\n\t\t}\n\t}\n"
67+
procedure_definition = <<EOT
68+
import com.snowflake.snowpark_java.*;
69+
class TestFunc {
70+
public static String echoVarchar(Session session, String x) {
71+
return x;
72+
}
73+
}
74+
EOT
6175
runtime_version = "11"
6276
snowpark_package = "1.14.0"
6377
@@ -139,7 +153,7 @@ resource "snowflake_procedure_java" "full" {
139153
Required:
140154

141155
- `arg_data_type` (String) The argument type.
142-
- `arg_name` (String) The argument name.
156+
- `arg_name` (String) The argument name. The provider wraps it in double quotes by default, so be aware of that while referencing the argument in the procedure definition.
143157

144158
Optional:
145159

docs/resources/procedure_javascript.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ resource "snowflake_procedure_javascript" "basic" {
4040
arg_name = "x"
4141
}
4242
return_type = "VARCHAR(100)"
43-
procedure_definition = "\n\tif (x \u003c= 0) {\n\t\treturn 1;\n\t} else {\n\t\tvar result = 1;\n\t\tfor (var i = 2; i \u003c= x; i++) {\n\t\t\tresult = result * i;\n\t\t}\n\t\treturn result;\n\t}\n"
43+
procedure_definition = <<EOT
44+
if (x == 0) {
45+
return 1;
46+
} else {
47+
return 2;
48+
}
49+
EOT
4450
}
4551
```
4652
-> **Note** Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult [identifiers guide](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/guides/identifiers#new-computed-fully-qualified-name-field-in-resources).
@@ -83,7 +89,7 @@ resource "snowflake_procedure_javascript" "basic" {
8389
Required:
8490

8591
- `arg_data_type` (String) The argument type.
86-
- `arg_name` (String) The argument name.
92+
- `arg_name` (String) The argument name. The provider wraps it in double quotes by default, so be aware of that while referencing the argument in the procedure definition.
8793

8894
Optional:
8995

0 commit comments

Comments
 (0)