diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bb79cd65a..1d1e6957ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [1.0.1](https://github.com/Snowflake-Labs/terraform-provider-snowflake/compare/v1.0.0...v1.0.1) (2024-12-20) + + +### 🔧 **Misc** + +* Add external removal tests to functions and procedures ([#3305](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3305)) ([e2d0705](https://github.com/Snowflake-Labs/terraform-provider-snowflake/commit/e2d07055015803b86f3c165851a63350beba350f)) +* Add holidays note, change the disclaimer, and fix an example ([#3288](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3288)) ([39a0cb7](https://github.com/Snowflake-Labs/terraform-provider-snowflake/commit/39a0cb76a1e64f2c4b5ee5923223d6e0df0ddb46)) +* Adjust GitHub templates to the new development branch ([#3286](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3286)) ([fc10672](https://github.com/Snowflake-Labs/terraform-provider-snowflake/commit/fc10672318af90ab6d879dfa63b8efaf93589e62)) +* Fix tests after v1 release ([#3306](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3306)) ([32983fe](https://github.com/Snowflake-Labs/terraform-provider-snowflake/commit/32983fe0d3ff502117b9c81d0d2c49b9d18958ba)) +* Generate marshal json for each model ([#3307](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3307)) ([7ebbe36](https://github.com/Snowflake-Labs/terraform-provider-snowflake/commit/7ebbe364c5829546a70843d249629f8fcc3cdcf6)) +* remove generating integration tests placeholder file ([#3256](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3256)) ([e0ed15b](https://github.com/Snowflake-Labs/terraform-provider-snowflake/commit/e0ed15b09017ddfc89c727a6f5a8e4bdaf7aa34d)) +* Update docs and migration guide ([#3313](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3313)) ([c98e449](https://github.com/Snowflake-Labs/terraform-provider-snowflake/commit/c98e44922a090495feb7b5c31c23b01d07f31bfc)) + + +### 🐛 **Bug fixes:** + +* Fixes in account parameters ([#3310](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3310)) ([0de5733](https://github.com/Snowflake-Labs/terraform-provider-snowflake/commit/0de57338fe32200a44bdd89730eb8bccaeeac3d5)) + ## [1.0.0](https://github.com/Snowflake-Labs/terraform-provider-snowflake/compare/v0.100.0...v1.0.0) (2024-12-12) diff --git a/CREATING_ISSUES.md b/CREATING_ISSUES.md index 274d61662c..bf82dcdf64 100644 --- a/CREATING_ISSUES.md +++ b/CREATING_ISSUES.md @@ -130,6 +130,14 @@ Please refer to [this document](https://github.com/Snowflake-Labs/terraform-prov [GitHub issue reference](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2432#issuecomment-1915074774) +**Problem**: Getting `Error: 260000: account is empty` error with non-empty `account` configuration after upgrading to v1, with the same provider configuration which worked up to v0.100.0 + +**Solution**: `account` configuration [has been removed in v1.0.0](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#removed-deprecated-objects). Please specify your organization name and account name separately as mentioned in the [migration guide](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#removed-deprecated-objects): +* `account_name` (`accountname` if you're sourcing it from `config` TOML) +* `organization_name` (`organizationname` if you're sourcing it from `config` TOML) + +GitHub issue reference: [#3198](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3198), [#3308](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3308) + ### How to set up the connection with the private key? **Problem:** From the version v0.78.0, we introduced a lot of provider configuration changes. One of them was deprecating `private_key_path` in favor of `private_key`. diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 3ecf522a66..1b05e256d8 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -7,61 +7,146 @@ across different versions. > [!TIP] > We highly recommend upgrading the versions one by one instead of bulk upgrades. +## v1.0.0 ➞ v1.0.1 + +### Fixes in account parameters +As a follow-up of reworked `snowflake_account_parameter`, this version has several improvements regarding handling parameters. + +#### Add missing parameters based on the docs and output of SHOW PARAMETERS IN ACCOUNT +Based on [parameters docs](https://docs.snowflake.com/en/sql-reference/parameters) and `SHOW PARAMETERS IN ACCOUNT`, we established a list of supported parameters. New supported or fixed parameters in `snowflake_account_parameter`: +- `ACTIVE_PYTHON_PROFILER` +- `CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS` +- `CORTEX_ENABLED_CROSS_REGION` +- `CSV_TIMESTAMP_FORMAT` +- `ENABLE_PERSONAL_DATABASE` +- `ENABLE_UNHANDLED_EXCEPTIONS_REPORTING` +- `ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES` +- `HYBRID_TABLE_LOCK_TIMEOUT` +- `JS_TREAT_INTEGER_AS_BIGINT` +- `PREVENT_UNLOAD_TO_INLINE_URL` +- `PREVENT_UNLOAD_TO_INTERNAL_STAGES` +- `PYTHON_PROFILER_MODULES` +- `PYTHON_PROFILER_TARGET_STAGE` +- `STORAGE_SERIALIZATION_POLICY` +- `TASK_AUTO_RETRY_ATTEMPTS` + +#### Adjusted validations +Validations for number parameters are now relaxed. This is because a few of the value limits are soft limits in Snowflake, and can be changed externally. +We decided to keep validations for non-negative values. Affected parameters: +- `QUERY_TAG` +- `TWO_DIGIT_CENTURY_START` +- `WEEK_OF_YEAR_POLICY` +- `WEEK_START` +- `USER_TASK_TIMEOUT_MS` + +We added non-negative validations for the following parameters: +- `CLIENT_PREFETCH_THREADS` +- `CLIENT_RESULT_CHUNK_SIZE` +- `CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY` +- `HYBRID_TABLE_LOCK_TIMEOUT` +- `JSON_INDENT` +- `STATEMENT_QUEUED_TIMEOUT_IN_SECONDS` +- `STATEMENT_TIMEOUT_IN_SECONDS` +- `TASK_AUTO_RETRY_ATTEMPTS` +- `USER_TASK_MINIMUM_TRIGGER_INTERVAL_IN_SECONDS` + +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. + +### Add missing preview features to config + +Values: +- `snowflake_functions_datasource` +- `snowflake_procedures_datasource` +- `snowflake_tables_datasource` + were missing in the `preview_features_enabled` attribute in the provider's config. They were added. + +References: #3302 + +### functions and procedures docs updated + +Argument names are automatically wrapped in double quotes, so: +- uppercase names should be used or +- argument name should be quoted in the procedure/function definition. + +Updated the docs and the previous migration guide entry. + +References: #3298 + +### python procedure docs updated + +Importing python procedure is currently limited to procedures with snowflake-snowpark-python version explicitly set in Snowflake. Docs were updated. + +References: #3303 + ## v0.100.0 ➞ v1.0.0 ### Preview features flag All of the preview features objects are now disabled by default. This includes: - Resources - - `snowflake_account_password_policy_attachment` - - `snowflake_alert` - - `snowflake_api_integration` - - `snowflake_cortex_search_service` - - `snowflake_dynamic_table` - - `snowflake_external_function` - - `snowflake_external_table` - - `snowflake_external_volume` - - `snowflake_failover_group` - - `snowflake_file_format` - - `snowflake_managed_account` - - `snowflake_materialized_view` - - `snowflake_network_policy_attachment` - - `snowflake_network_rule` - - `snowflake_email_notification_integration` - - `snowflake_notification_integration` - - `snowflake_object_parameter` - - `snowflake_password_policy` - - `snowflake_pipe` - - `snowflake_sequence` - - `snowflake_share` - - `snowflake_stage` - - `snowflake_storage_integration` - - `snowflake_table_column_masking_policy_application` - - `snowflake_table_constraint` - - `snowflake_user_public_keys` - - `snowflake_user_password_policy_attachment` + - `snowflake_account_password_policy_attachment` + - `snowflake_alert` + - `snowflake_api_integration` + - `snowflake_cortex_search_service` + - `snowflake_dynamic_table` + - `snowflake_external_function` + - `snowflake_external_table` + - `snowflake_external_volume` + - `snowflake_failover_group` + - `snowflake_file_format` + - `snowflake_function_java` + - `snowflake_function_javascript` + - `snowflake_function_python` + - `snowflake_function_scala` + - `snowflake_function_sql` + - `snowflake_managed_account` + - `snowflake_materialized_view` + - `snowflake_network_policy_attachment` + - `snowflake_network_rule` + - `snowflake_email_notification_integration` + - `snowflake_notification_integration` + - `snowflake_object_parameter` + - `snowflake_password_policy` + - `snowflake_pipe` + - `snowflake_procedure_java` + - `snowflake_procedure_javascript` + - `snowflake_procedure_python` + - `snowflake_procedure_scala` + - `snowflake_procedure_sql` + - `snowflake_sequence` + - `snowflake_share` + - `snowflake_stage` + - `snowflake_storage_integration` + - `snowflake_table` + - `snowflake_table_column_masking_policy_application` + - `snowflake_table_constraint` + - `snowflake_user_public_keys` + - `snowflake_user_password_policy_attachment` - Data sources - - `snowflake_current_account` - - `snowflake_alerts` - - `snowflake_cortex_search_services` - - `snowflake_database` - - `snowflake_database_role` - - `snowflake_dynamic_tables` - - `snowflake_external_functions` - - `snowflake_external_tables` - - `snowflake_failover_groups` - - `snowflake_file_formats` - - `snowflake_materialized_views` - - `snowflake_pipes` - - `snowflake_current_role` - - `snowflake_sequences` - - `snowflake_shares` - - `snowflake_parameters` - - `snowflake_stages` - - `snowflake_storage_integrations` - - `snowflake_system_generate_scim_access_token` - - `snowflake_system_get_aws_sns_iam_policy` - - `snowflake_system_get_privatelink_config` - - `snowflake_system_get_snowflake_platform_info` + - `snowflake_current_account` + - `snowflake_alerts` + - `snowflake_cortex_search_services` + - `snowflake_database` + - `snowflake_database_role` + - `snowflake_dynamic_tables` + - `snowflake_external_functions` + - `snowflake_external_tables` + - `snowflake_failover_groups` + - `snowflake_file_formats` + - `snowflake_functions` + - `snowflake_materialized_views` + - `snowflake_pipes` + - `snowflake_procedures` + - `snowflake_current_role` + - `snowflake_sequences` + - `snowflake_shares` + - `snowflake_parameters` + - `snowflake_stages` + - `snowflake_storage_integrations` + - `snowflake_system_generate_scim_access_token` + - `snowflake_system_get_aws_sns_iam_policy` + - `snowflake_system_get_privatelink_config` + - `snowflake_system_get_snowflake_platform_info` + - `snowflake_tables` If you want to have them enabled, add the feature name to the provider configuration (with `_datasource` or `_resource` suffix), like this: ```terraform @@ -125,6 +210,8 @@ The new resources are more aligned with current features like: - secrets support - argument default values +**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). + `snowflake_procedure` is now deprecated in favor of 5 new preview resources: - `snowflake_procedure_java` @@ -141,6 +228,8 @@ The new resources are more aligned with current features like: - secrets support - argument default values +**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). + ### *(new feature)* Account role data source Added a new `snowflake_account_roles` data source for account roles. Now it reflects It's based on `snowflake_roles` data source. `account_roles` field now organizes output of show under `show_output` field. diff --git a/docs/resources/account_parameter.md b/docs/resources/account_parameter.md index 07b49e485f..c5fee04863 100644 --- a/docs/resources/account_parameter.md +++ b/docs/resources/account_parameter.md @@ -34,7 +34,7 @@ resource "snowflake_account_parameter" "p2" { ### Required -- `key` (String) Name of account parameter. Valid values are (case-insensitive): `ALLOW_CLIENT_MFA_CACHING` | `ALLOW_ID_TOKEN` | `CLIENT_ENCRYPTION_KEY_SIZE` | `ENABLE_IDENTIFIER_FIRST_LOGIN` | `ENABLE_INTERNAL_STAGES_PRIVATELINK` | `ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_IMAGE_REPOSITORY` | `ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_SPCS_BLOCK_STORAGE` | `EVENT_TABLE` | `EXTERNAL_OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST` | `INITIAL_REPLICATION_SIZE_LIMIT_IN_TB` | `MIN_DATA_RETENTION_TIME_IN_DAYS` | `NETWORK_POLICY` | `OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST` | `PERIODIC_DATA_REKEYING` | `PREVENT_LOAD_FROM_INLINE_URL` | `PREVENT_UNLOAD_TO_INLINE_URL` | `PREVENT_UNLOAD_TO_INTERNAL_STAGES` | `REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION` | `REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION` | `SSO_LOGIN_PAGE` | `ABORT_DETACHED_QUERY` | `AUTOCOMMIT` | `BINARY_INPUT_FORMAT` | `BINARY_OUTPUT_FORMAT` | `CLIENT_MEMORY_LIMIT` | `CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX` | `CLIENT_METADATA_USE_SESSION_DATABASE` | `CLIENT_PREFETCH_THREADS` | `CLIENT_RESULT_CHUNK_SIZE` | `CLIENT_SESSION_KEEP_ALIVE` | `CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY` | `CLIENT_TIMESTAMP_TYPE_MAPPING` | `ENABLE_UNLOAD_PHYSICAL_TYPE_OPTIMIZATION` | `CLIENT_RESULT_COLUMN_CASE_INSENSITIVE` | `DATE_INPUT_FORMAT` | `DATE_OUTPUT_FORMAT` | `ERROR_ON_NONDETERMINISTIC_MERGE` | `ERROR_ON_NONDETERMINISTIC_UPDATE` | `GEOGRAPHY_OUTPUT_FORMAT` | `GEOMETRY_OUTPUT_FORMAT` | `JDBC_TREAT_DECIMAL_AS_INT` | `JDBC_TREAT_TIMESTAMP_NTZ_AS_UTC` | `JDBC_USE_SESSION_TIMEZONE` | `JSON_INDENT` | `LOCK_TIMEOUT` | `MULTI_STATEMENT_COUNT` | `NOORDER_SEQUENCE_AS_DEFAULT` | `ODBC_TREAT_DECIMAL_AS_INT` | `QUERY_TAG` | `QUOTED_IDENTIFIERS_IGNORE_CASE` | `ROWS_PER_RESULTSET` | `S3_STAGE_VPCE_DNS_NAME` | `SEARCH_PATH` | `SIMULATED_DATA_SHARING_CONSUMER` | `STATEMENT_TIMEOUT_IN_SECONDS` | `STRICT_JSON_OUTPUT` | `TIME_INPUT_FORMAT` | `TIME_OUTPUT_FORMAT` | `TIMESTAMP_DAY_IS_ALWAYS_24H` | `TIMESTAMP_INPUT_FORMAT` | `TIMESTAMP_LTZ_OUTPUT_FORMAT` | `TIMESTAMP_NTZ_OUTPUT_FORMAT` | `TIMESTAMP_OUTPUT_FORMAT` | `TIMESTAMP_TYPE_MAPPING` | `TIMESTAMP_TZ_OUTPUT_FORMAT` | `TIMEZONE` | `TRANSACTION_ABORT_ON_ERROR` | `TRANSACTION_DEFAULT_ISOLATION_LEVEL` | `TWO_DIGIT_CENTURY_START` | `UNSUPPORTED_DDL_ACTION` | `USE_CACHED_RESULT` | `WEEK_OF_YEAR_POLICY` | `WEEK_START` | `CATALOG` | `DATA_RETENTION_TIME_IN_DAYS` | `DEFAULT_DDL_COLLATION` | `EXTERNAL_VOLUME` | `LOG_LEVEL` | `MAX_CONCURRENCY_LEVEL` | `MAX_DATA_EXTENSION_TIME_IN_DAYS` | `PIPE_EXECUTION_PAUSED` | `PREVENT_UNLOAD_TO_INTERNAL_STAGES` | `REPLACE_INVALID_CHARACTERS` | `STATEMENT_QUEUED_TIMEOUT_IN_SECONDS` | `STORAGE_SERIALIZATION_POLICY` | `SHARE_RESTRICTIONS` | `SUSPEND_TASK_AFTER_NUM_FAILURES` | `TRACE_LEVEL` | `USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE` | `USER_TASK_TIMEOUT_MS` | `TASK_AUTO_RETRY_ATTEMPTS` | `USER_TASK_MINIMUM_TRIGGER_INTERVAL_IN_SECONDS` | `METRIC_LEVEL` | `ENABLE_CONSOLE_OUTPUT` | `ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR`. +- `key` (String) Name of account parameter. Valid values are (case-insensitive): `ALLOW_CLIENT_MFA_CACHING` | `ALLOW_ID_TOKEN` | `CLIENT_ENCRYPTION_KEY_SIZE` | `CORTEX_ENABLED_CROSS_REGION` | `ENABLE_IDENTIFIER_FIRST_LOGIN` | `ENABLE_INTERNAL_STAGES_PRIVATELINK` | `ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_IMAGE_REPOSITORY` | `ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_SPCS_BLOCK_STORAGE` | `ENABLE_UNHANDLED_EXCEPTIONS_REPORTING` | `ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES` | `EVENT_TABLE` | `EXTERNAL_OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST` | `INITIAL_REPLICATION_SIZE_LIMIT_IN_TB` | `MIN_DATA_RETENTION_TIME_IN_DAYS` | `NETWORK_POLICY` | `OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST` | `PERIODIC_DATA_REKEYING` | `PREVENT_LOAD_FROM_INLINE_URL` | `PREVENT_UNLOAD_TO_INLINE_URL` | `REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION` | `REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION` | `SSO_LOGIN_PAGE` | `ABORT_DETACHED_QUERY` | `ACTIVE_PYTHON_PROFILER` | `AUTOCOMMIT` | `BINARY_INPUT_FORMAT` | `BINARY_OUTPUT_FORMAT` | `CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS` | `CLIENT_MEMORY_LIMIT` | `CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX` | `CLIENT_METADATA_USE_SESSION_DATABASE` | `CLIENT_PREFETCH_THREADS` | `CLIENT_RESULT_CHUNK_SIZE` | `CLIENT_SESSION_KEEP_ALIVE` | `CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY` | `CLIENT_TIMESTAMP_TYPE_MAPPING` | `ENABLE_UNLOAD_PHYSICAL_TYPE_OPTIMIZATION` | `CLIENT_RESULT_COLUMN_CASE_INSENSITIVE` | `CSV_TIMESTAMP_FORMAT` | `DATE_INPUT_FORMAT` | `DATE_OUTPUT_FORMAT` | `ERROR_ON_NONDETERMINISTIC_MERGE` | `ERROR_ON_NONDETERMINISTIC_UPDATE` | `GEOGRAPHY_OUTPUT_FORMAT` | `GEOMETRY_OUTPUT_FORMAT` | `HYBRID_TABLE_LOCK_TIMEOUT` | `JDBC_TREAT_DECIMAL_AS_INT` | `JDBC_TREAT_TIMESTAMP_NTZ_AS_UTC` | `JDBC_USE_SESSION_TIMEZONE` | `JSON_INDENT` | `JS_TREAT_INTEGER_AS_BIGINT` | `LOCK_TIMEOUT` | `MULTI_STATEMENT_COUNT` | `NOORDER_SEQUENCE_AS_DEFAULT` | `ODBC_TREAT_DECIMAL_AS_INT` | `PYTHON_PROFILER_MODULES` | `PYTHON_PROFILER_TARGET_STAGE` | `QUERY_TAG` | `QUOTED_IDENTIFIERS_IGNORE_CASE` | `ROWS_PER_RESULTSET` | `S3_STAGE_VPCE_DNS_NAME` | `SEARCH_PATH` | `SIMULATED_DATA_SHARING_CONSUMER` | `STATEMENT_TIMEOUT_IN_SECONDS` | `STRICT_JSON_OUTPUT` | `TIME_INPUT_FORMAT` | `TIME_OUTPUT_FORMAT` | `TIMESTAMP_DAY_IS_ALWAYS_24H` | `TIMESTAMP_INPUT_FORMAT` | `TIMESTAMP_LTZ_OUTPUT_FORMAT` | `TIMESTAMP_NTZ_OUTPUT_FORMAT` | `TIMESTAMP_OUTPUT_FORMAT` | `TIMESTAMP_TYPE_MAPPING` | `TIMESTAMP_TZ_OUTPUT_FORMAT` | `TIMEZONE` | `TRANSACTION_ABORT_ON_ERROR` | `TRANSACTION_DEFAULT_ISOLATION_LEVEL` | `TWO_DIGIT_CENTURY_START` | `UNSUPPORTED_DDL_ACTION` | `USE_CACHED_RESULT` | `WEEK_OF_YEAR_POLICY` | `WEEK_START` | `CATALOG` | `DATA_RETENTION_TIME_IN_DAYS` | `DEFAULT_DDL_COLLATION` | `EXTERNAL_VOLUME` | `LOG_LEVEL` | `MAX_CONCURRENCY_LEVEL` | `MAX_DATA_EXTENSION_TIME_IN_DAYS` | `PIPE_EXECUTION_PAUSED` | `PREVENT_UNLOAD_TO_INTERNAL_STAGES` | `REPLACE_INVALID_CHARACTERS` | `STATEMENT_QUEUED_TIMEOUT_IN_SECONDS` | `STORAGE_SERIALIZATION_POLICY` | `SHARE_RESTRICTIONS` | `SUSPEND_TASK_AFTER_NUM_FAILURES` | `TRACE_LEVEL` | `USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE` | `USER_TASK_TIMEOUT_MS` | `TASK_AUTO_RETRY_ATTEMPTS` | `USER_TASK_MINIMUM_TRIGGER_INTERVAL_IN_SECONDS` | `METRIC_LEVEL` | `ENABLE_CONSOLE_OUTPUT` | `ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR` | `ENABLE_PERSONAL_DATABASE`. Deprecated parameters are not supported in the provider. - `value` (String) Value of account parameter, as a string. Constraints are the same as those for the parameters in Snowflake documentation. The parameter values are validated in Snowflake. ### Read-Only diff --git a/docs/resources/function_java.md b/docs/resources/function_java.md index 5570e2575e..2ad592c726 100644 --- a/docs/resources/function_java.md +++ b/docs/resources/function_java.md @@ -40,7 +40,13 @@ resource "snowflake_function_java" "w" { } return_type = "VARCHAR(100)" handler = "TestFunc.echoVarchar" - function_definition = "\n\tclass TestFunc {\n\t\tpublic static String echoVarchar(String x) {\n\t\t\treturn x;\n\t\t}\n\t}\n" + function_definition = < **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" { Required: - `arg_data_type` (String) The argument type. -- `arg_name` (String) The argument name. +- `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. Optional: diff --git a/docs/resources/function_javascript.md b/docs/resources/function_javascript.md index 9333693081..c587e4b9a9 100644 --- a/docs/resources/function_javascript.md +++ b/docs/resources/function_javascript.md @@ -39,10 +39,14 @@ resource "snowflake_function_javascript" "minimal" { arg_data_type = "VARIANT" arg_name = "x" } - function_definition = < **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" { Required: - `arg_data_type` (String) The argument type. -- `arg_name` (String) The argument name. +- `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. Optional: diff --git a/docs/resources/function_python.md b/docs/resources/function_python.md index a2cf487db5..249a4d8ebc 100644 --- a/docs/resources/function_python.md +++ b/docs/resources/function_python.md @@ -42,12 +42,15 @@ resource "snowflake_function_python" "minimal" { arg_data_type = "NUMBER(36, 2)" arg_name = "x" } - function_definition = < **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" { Required: - `arg_data_type` (String) The argument type. -- `arg_name` (String) The argument name. +- `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. Optional: diff --git a/docs/resources/function_scala.md b/docs/resources/function_scala.md index 9a03c90548..9cea381089 100644 --- a/docs/resources/function_scala.md +++ b/docs/resources/function_scala.md @@ -37,16 +37,16 @@ resource "snowflake_function_scala" "minimal" { arg_data_type = "VARCHAR(100)" arg_name = "x" } - function_definition = <❄️❄️ +terraform import snowflake_object_parameter.s || ``` diff --git a/docs/resources/procedure_java.md b/docs/resources/procedure_java.md index 3dd3858f89..545cd1efed 100644 --- a/docs/resources/procedure_java.md +++ b/docs/resources/procedure_java.md @@ -41,7 +41,14 @@ resource "snowflake_procedure_java" "basic" { } return_type = "VARCHAR(100)" handler = "TestFunc.echoVarchar" - 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" + procedure_definition = < **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" { Required: - `arg_data_type` (String) The argument type. -- `arg_name` (String) The argument name. +- `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. Optional: diff --git a/docs/resources/procedure_python.md b/docs/resources/procedure_python.md index 76d9495fd4..0ad0eb5505 100644 --- a/docs/resources/procedure_python.md +++ b/docs/resources/procedure_python.md @@ -7,6 +7,8 @@ description: |- !> **Caution: Preview Feature** This feature is considered a preview feature in the provider, regardless of the state of the resource in Snowflake. We do not guarantee its stability. It will be reworked and marked as a stable feature in future releases. Breaking changes are expected, even without bumping the major version. To use this feature, add the relevant feature name to `preview_features_enabled field` in the [provider configuration](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs#schema). Please always refer to the [Getting Help](https://github.com/Snowflake-Labs/terraform-provider-snowflake?tab=readme-ov-file#getting-help) section in our Github repo to best determine how to get help for your questions. +!> **Caution: Import limitation** To import the python procedure, snowflake-snowpark-python version must be explicitly set in Snowflake (i.e. `snowflake-snowpark-python==1.14.0`). You can verify it by running `DESCRIBE PROCEDURE ` and checking the `packages`. Check [#3303](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3303) for reference. + -> **Note** External changes to `is_secure` and `null_input_behavior` are not currently supported. They will be handled in the following versions of the provider which may still affect this resource. -> **Note** `COPY GRANTS` and `OR REPLACE` are not currently supported. @@ -42,7 +44,13 @@ resource "snowflake_procedure_python" "w" { } return_type = "VARCHAR(100)" handler = "echoVarchar" - procedure_definition = "\ndef echoVarchar(x):\n\tresult = \"\"\n\tfor a in range(5):\n\t\tresult += x\n\treturn result\n" + procedure_definition = < **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). @@ -80,7 +84,7 @@ resource "snowflake_procedure_sql" "w" { Required: - `arg_data_type` (String) The argument type. -- `arg_name` (String) The argument name. +- `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. Optional: diff --git a/examples/resources/snowflake_function_java/resource.tf b/examples/resources/snowflake_function_java/resource.tf index a34d6af477..2be224de9c 100644 --- a/examples/resources/snowflake_function_java/resource.tf +++ b/examples/resources/snowflake_function_java/resource.tf @@ -8,5 +8,11 @@ resource "snowflake_function_java" "w" { } return_type = "VARCHAR(100)" handler = "TestFunc.echoVarchar" - function_definition = "\n\tclass TestFunc {\n\t\tpublic static String echoVarchar(String x) {\n\t\t\treturn x;\n\t\t}\n\t}\n" + function_definition = <❄️❄️ +terraform import snowflake_object_parameter.s || diff --git a/examples/resources/snowflake_procedure_java/resource.tf b/examples/resources/snowflake_procedure_java/resource.tf index 6f3bc051b9..6393b3adf7 100644 --- a/examples/resources/snowflake_procedure_java/resource.tf +++ b/examples/resources/snowflake_procedure_java/resource.tf @@ -9,7 +9,14 @@ resource "snowflake_procedure_java" "basic" { } return_type = "VARCHAR(100)" handler = "TestFunc.echoVarchar" - 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" + procedure_definition = < 0 { - sb.WriteString(fmt.Sprintf("\tdepends_on = [%s]\n", strings.Join(model.DependsOn(), ", "))) - } - sb.WriteString(`}`) - sb.WriteRune('\n') - s := sb.String() - t.Logf("Generated config:\n%s", s) - return s -} - -// FromModelsDeprecated allows to combine multiple resource models. -// Use FromModels instead. -func FromModelsDeprecated(t *testing.T, models ...ResourceModel) string { - t.Helper() - var sb strings.Builder - for _, model := range models { - sb.WriteString(FromModel(t, model) + "\n") - } - return sb.String() -} - // ConfigVariablesFromModel constructs config.Variables needed in acceptance tests that are using ConfigVariables in // combination with ConfigDirectory. It's necessary for cases not supported by FromModel, like lists of objects. // Use ResourceFromModel, DatasourceFromModel, ProviderFromModel, and FromModels instead. diff --git a/pkg/acceptance/bettertestspoc/config/config_test.go b/pkg/acceptance/bettertestspoc/config/config_test.go index f061058adc..5c6959012d 100644 --- a/pkg/acceptance/bettertestspoc/config/config_test.go +++ b/pkg/acceptance/bettertestspoc/config/config_test.go @@ -35,6 +35,9 @@ resource "snowflake_share" "test" { Item{IntField: 2, StringField: "second item"}, ). WithSingleObject("one", 2). + WithTextFieldExplicitNull(). + WithListFieldEmpty(). + WithMultilineField("some\nmultiline\ncontent"). WithDependsOn("some_other_resource.some_name", "other_resource.some_other_name", "third_resource.third_name") expectedOutput := strings.TrimPrefix(` resource "snowflake_share" "test" { @@ -54,6 +57,13 @@ resource "snowflake_share" "test" { a = "one" b = 2 } + text_field = null + list_field = [] + multiline_field = < 2000 { - errs = append(errs, errIntValue("SessionParameters", "QueryTag", IntErrLess, 2000)) + if valueSet(v.MultiStatementCount) { + if !validateIntGreaterThanOrEqual(*v.MultiStatementCount, 0) { + errs = append(errs, errIntValue("SessionParameters", "MultiStatementCount", IntErrGreaterOrEqual, 0)) } } if valueSet(v.RowsPerResultset) { @@ -1426,19 +1547,29 @@ func (v *SessionParameters) validate() error { errs = append(errs, errIntValue("SessionParameters", "RowsPerResultset", IntErrGreaterOrEqual, 0)) } } + if valueSet(v.StatementQueuedTimeoutInSeconds) { + if !validateIntGreaterThanOrEqual(*v.StatementQueuedTimeoutInSeconds, 0) { + errs = append(errs, errIntValue("SessionParameters", "StatementQueuedTimeoutInSeconds", IntErrGreaterOrEqual, 0)) + } + } + if valueSet(v.StatementTimeoutInSeconds) { + if !validateIntGreaterThanOrEqual(*v.StatementTimeoutInSeconds, 0) { + errs = append(errs, errIntValue("SessionParameters", "StatementTimeoutInSeconds", IntErrGreaterOrEqual, 0)) + } + } if valueSet(v.TwoDigitCenturyStart) { - if !validateIntInRange(*v.TwoDigitCenturyStart, 1900, 2100) { - errs = append(errs, errIntBetween("SessionParameters", "TwoDigitCenturyStart", 1900, 2100)) + if !validateIntGreaterThanOrEqual(*v.TwoDigitCenturyStart, 1900) { + errs = append(errs, errIntValue("SessionParameters", "TwoDigitCenturyStart", IntErrGreaterOrEqual, 1900)) } } if valueSet(v.WeekOfYearPolicy) { - if !validateIntInRange(*v.WeekOfYearPolicy, 0, 1) { - errs = append(errs, fmt.Errorf("WEEK_OF_YEAR_POLICY must be either 0 or 1")) + if !validateIntGreaterThanOrEqual(*v.WeekOfYearPolicy, 0) { + errs = append(errs, errIntValue("SessionParameters", "WeekOfYearPolicy", IntErrGreaterOrEqual, 0)) } } if valueSet(v.WeekStart) { - if !validateIntInRange(*v.WeekStart, 0, 1) { - errs = append(errs, fmt.Errorf("WEEK_START must be either 0 or 1")) + if !validateIntGreaterThanOrEqual(*v.WeekStart, 0) { + errs = append(errs, errIntValue("SessionParameters", "WeekStart", IntErrGreaterOrEqual, 0)) } } return errors.Join(errs...) @@ -1446,9 +1577,11 @@ func (v *SessionParameters) validate() error { type SessionParametersUnset struct { AbortDetachedQuery *bool `ddl:"keyword" sql:"ABORT_DETACHED_QUERY"` + ActivePythonProfiler *bool `ddl:"keyword" sql:"ACTIVE_PYTHON_PROFILER"` Autocommit *bool `ddl:"keyword" sql:"AUTOCOMMIT"` BinaryInputFormat *bool `ddl:"keyword" sql:"BINARY_INPUT_FORMAT"` BinaryOutputFormat *bool `ddl:"keyword" sql:"BINARY_OUTPUT_FORMAT"` + ClientEnableLogInfoStatementParameters *bool `ddl:"keyword" sql:"CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS"` ClientMemoryLimit *bool `ddl:"keyword" sql:"CLIENT_MEMORY_LIMIT"` ClientMetadataRequestUseConnectionCtx *bool `ddl:"keyword" sql:"CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX"` ClientPrefetchThreads *bool `ddl:"keyword" sql:"CLIENT_PREFETCH_THREADS"` @@ -1458,6 +1591,7 @@ type SessionParametersUnset struct { ClientSessionKeepAlive *bool `ddl:"keyword" sql:"CLIENT_SESSION_KEEP_ALIVE"` ClientSessionKeepAliveHeartbeatFrequency *bool `ddl:"keyword" sql:"CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY"` ClientTimestampTypeMapping *bool `ddl:"keyword" sql:"CLIENT_TIMESTAMP_TYPE_MAPPING"` + CsvTimestampFormat *bool `ddl:"keyword" sql:"CSV_TIMESTAMP_FORMAT"` DateInputFormat *bool `ddl:"keyword" sql:"DATE_INPUT_FORMAT"` DateOutputFormat *bool `ddl:"keyword" sql:"DATE_OUTPUT_FORMAT"` EnableUnloadPhysicalTypeOptimization *bool `ddl:"keyword" sql:"ENABLE_UNLOAD_PHYSICAL_TYPE_OPTIMIZATION"` @@ -1465,15 +1599,19 @@ type SessionParametersUnset struct { ErrorOnNondeterministicUpdate *bool `ddl:"keyword" sql:"ERROR_ON_NONDETERMINISTIC_UPDATE"` GeographyOutputFormat *bool `ddl:"keyword" sql:"GEOGRAPHY_OUTPUT_FORMAT"` GeometryOutputFormat *bool `ddl:"keyword" sql:"GEOMETRY_OUTPUT_FORMAT"` + HybridTableLockTimeout *bool `ddl:"keyword" sql:"HYBRID_TABLE_LOCK_TIMEOUT"` JdbcTreatDecimalAsInt *bool `ddl:"keyword" sql:"JDBC_TREAT_DECIMAL_AS_INT"` JdbcTreatTimestampNtzAsUtc *bool `ddl:"keyword" sql:"JDBC_TREAT_TIMESTAMP_NTZ_AS_UTC"` JdbcUseSessionTimezone *bool `ddl:"keyword" sql:"JDBC_USE_SESSION_TIMEZONE"` - JSONIndent *bool `ddl:"keyword" sql:"JSON_INDENT"` + JsonIndent *bool `ddl:"keyword" sql:"JSON_INDENT"` + JsTreatIntegerAsBigInt *bool `ddl:"keyword" sql:"JS_TREAT_INTEGER_AS_BIGINT"` LockTimeout *bool `ddl:"keyword" sql:"LOCK_TIMEOUT"` LogLevel *bool `ddl:"keyword" sql:"LOG_LEVEL"` MultiStatementCount *bool `ddl:"keyword" sql:"MULTI_STATEMENT_COUNT"` NoorderSequenceAsDefault *bool `ddl:"keyword" sql:"NOORDER_SEQUENCE_AS_DEFAULT"` OdbcTreatDecimalAsInt *bool `ddl:"keyword" sql:"ODBC_TREAT_DECIMAL_AS_INT"` + PythonProfilerModules *bool `ddl:"keyword" sql:"PYTHON_PROFILER_MODULES"` + PythonProfilerTargetStage *bool `ddl:"keyword" sql:"PYTHON_PROFILER_TARGET_STAGE"` QueryTag *bool `ddl:"keyword" sql:"QUERY_TAG"` QuotedIdentifiersIgnoreCase *bool `ddl:"keyword" sql:"QUOTED_IDENTIFIERS_IGNORE_CASE"` RowsPerResultset *bool `ddl:"keyword" sql:"ROWS_PER_RESULTSET"` @@ -1482,7 +1620,7 @@ type SessionParametersUnset struct { SimulatedDataSharingConsumer *bool `ddl:"keyword" sql:"SIMULATED_DATA_SHARING_CONSUMER"` StatementQueuedTimeoutInSeconds *bool `ddl:"keyword" sql:"STATEMENT_QUEUED_TIMEOUT_IN_SECONDS"` StatementTimeoutInSeconds *bool `ddl:"keyword" sql:"STATEMENT_TIMEOUT_IN_SECONDS"` - StrictJSONOutput *bool `ddl:"keyword" sql:"STRICT_JSON_OUTPUT"` + StrictJsonOutput *bool `ddl:"keyword" sql:"STRICT_JSON_OUTPUT"` TimestampDayIsAlways24h *bool `ddl:"keyword" sql:"TIMESTAMP_DAY_IS_ALWAYS_24H"` TimestampInputFormat *bool `ddl:"keyword" sql:"TIMESTAMP_INPUT_FORMAT"` TimestampLTZOutputFormat *bool `ddl:"keyword" sql:"TIMESTAMP_LTZ_OUTPUT_FORMAT"` @@ -1504,37 +1642,40 @@ type SessionParametersUnset struct { } func (v *SessionParametersUnset) validate() error { - if !anyValueSet(v.AbortDetachedQuery, v.Autocommit, v.BinaryInputFormat, v.BinaryOutputFormat, v.ClientMemoryLimit, v.ClientMetadataRequestUseConnectionCtx, v.ClientPrefetchThreads, v.ClientResultChunkSize, v.ClientResultColumnCaseInsensitive, v.ClientMetadataUseSessionDatabase, v.ClientSessionKeepAlive, v.ClientSessionKeepAliveHeartbeatFrequency, v.ClientTimestampTypeMapping, v.DateInputFormat, v.DateOutputFormat, v.EnableUnloadPhysicalTypeOptimization, v.ErrorOnNondeterministicMerge, v.ErrorOnNondeterministicUpdate, v.GeographyOutputFormat, v.GeometryOutputFormat, v.JdbcTreatDecimalAsInt, v.JdbcTreatTimestampNtzAsUtc, v.JdbcUseSessionTimezone, v.JSONIndent, v.LockTimeout, v.LogLevel, v.MultiStatementCount, v.NoorderSequenceAsDefault, v.OdbcTreatDecimalAsInt, v.QueryTag, v.QuotedIdentifiersIgnoreCase, v.RowsPerResultset, v.S3StageVpceDnsName, v.SearchPath, v.SimulatedDataSharingConsumer, v.StatementQueuedTimeoutInSeconds, v.StatementTimeoutInSeconds, v.StrictJSONOutput, v.TimestampDayIsAlways24h, v.TimestampInputFormat, v.TimestampLTZOutputFormat, v.TimestampNTZOutputFormat, v.TimestampOutputFormat, v.TimestampTypeMapping, v.TimestampTZOutputFormat, v.Timezone, v.TimeInputFormat, v.TimeOutputFormat, v.TraceLevel, v.TransactionAbortOnError, v.TransactionDefaultIsolationLevel, v.TwoDigitCenturyStart, v.UnsupportedDDLAction, v.UseCachedResult, v.WeekOfYearPolicy, v.WeekStart) { - return errors.Join(errAtLeastOneOf("SessionParametersUnset", "AbortDetachedQuery", "Autocommit", "BinaryInputFormat", "BinaryOutputFormat", "ClientMemoryLimit", "ClientMetadataRequestUseConnectionCtx", "ClientPrefetchThreads", "ClientResultChunkSize", "ClientResultColumnCaseInsensitive", "ClientMetadataUseSessionDatabase", "ClientSessionKeepAlive", "ClientSessionKeepAliveHeartbeatFrequency", "ClientTimestampTypeMapping", "DateInputFormat", "DateOutputFormat", "EnableUnloadPhysicalTypeOptimization", "ErrorOnNondeterministicMerge", "ErrorOnNondeterministicUpdate", "GeographyOutputFormat", "GeometryOutputFormat", "JdbcTreatDecimalAsInt", "JdbcTreatTimestampNtzAsUtc", "JdbcUseSessionTimezone", "JSONIndent", "LockTimeout", "LogLevel", "MultiStatementCount", "NoorderSequenceAsDefault", "OdbcTreatDecimalAsInt", "QueryTag", "QuotedIdentifiersIgnoreCase", "RowsPerResultset", "S3StageVpceDnsName", "SearchPath", "SimulatedDataSharingConsumer", "StatementQueuedTimeoutInSeconds", "StatementTimeoutInSeconds", "StrictJSONOutput", "TimestampDayIsAlways24h", "TimestampInputFormat", "TimestampLTZOutputFormat", "TimestampNTZOutputFormat", "TimestampOutputFormat", "TimestampTypeMapping", "TimestampTZOutputFormat", "Timezone", "TimeInputFormat", "TimeOutputFormat", "TraceLevel", "TransactionAbortOnError", "TransactionDefaultIsolationLevel", "TwoDigitCenturyStart", "UnsupportedDDLAction", "UseCachedResult", "WeekOfYearPolicy", "WeekStart")) + if !anyValueSet(v.AbortDetachedQuery, v.ActivePythonProfiler, v.Autocommit, v.BinaryInputFormat, v.BinaryOutputFormat, v.ClientEnableLogInfoStatementParameters, v.ClientMemoryLimit, v.ClientMetadataRequestUseConnectionCtx, v.ClientPrefetchThreads, v.ClientResultChunkSize, v.ClientResultColumnCaseInsensitive, v.ClientMetadataUseSessionDatabase, v.ClientSessionKeepAlive, v.ClientSessionKeepAliveHeartbeatFrequency, v.ClientTimestampTypeMapping, v.CsvTimestampFormat, v.DateInputFormat, v.DateOutputFormat, v.EnableUnloadPhysicalTypeOptimization, v.ErrorOnNondeterministicMerge, v.ErrorOnNondeterministicUpdate, v.GeographyOutputFormat, v.GeometryOutputFormat, v.HybridTableLockTimeout, v.JdbcTreatDecimalAsInt, v.JdbcTreatTimestampNtzAsUtc, v.JdbcUseSessionTimezone, v.JsonIndent, v.JsTreatIntegerAsBigInt, v.LockTimeout, v.LogLevel, v.MultiStatementCount, v.NoorderSequenceAsDefault, v.OdbcTreatDecimalAsInt, v.PythonProfilerModules, v.PythonProfilerTargetStage, v.QueryTag, v.QuotedIdentifiersIgnoreCase, v.RowsPerResultset, v.S3StageVpceDnsName, v.SearchPath, v.SimulatedDataSharingConsumer, v.StatementQueuedTimeoutInSeconds, v.StatementTimeoutInSeconds, v.StrictJsonOutput, v.TimestampDayIsAlways24h, v.TimestampInputFormat, v.TimestampLTZOutputFormat, v.TimestampNTZOutputFormat, v.TimestampOutputFormat, v.TimestampTypeMapping, v.TimestampTZOutputFormat, v.Timezone, v.TimeInputFormat, v.TimeOutputFormat, v.TraceLevel, v.TransactionAbortOnError, v.TransactionDefaultIsolationLevel, v.TwoDigitCenturyStart, v.UnsupportedDDLAction, v.UseCachedResult, v.WeekOfYearPolicy, v.WeekStart) { + return errors.Join(errAtLeastOneOf("SessionParametersUnset", "AbortDetachedQuery", "ActivePythonProfiler", "Autocommit", "BinaryInputFormat", "BinaryOutputFormat", "ClientEnableLogInfoStatementParameters", "ClientMemoryLimit", "ClientMetadataRequestUseConnectionCtx", "ClientPrefetchThreads", "ClientResultChunkSize", "ClientResultColumnCaseInsensitive", "ClientMetadataUseSessionDatabase", "ClientSessionKeepAlive", "ClientSessionKeepAliveHeartbeatFrequency", "ClientTimestampTypeMapping", "CsvTimestampFormat", "DateInputFormat", "DateOutputFormat", "EnableUnloadPhysicalTypeOptimization", "ErrorOnNondeterministicMerge", "ErrorOnNondeterministicUpdate", "GeographyOutputFormat", "GeometryOutputFormat", "HybridTableLockTimeout", "JdbcTreatDecimalAsInt", "JdbcTreatTimestampNtzAsUtc", "JdbcUseSessionTimezone", "JsonIndent", "JsTreatIntegerAsBigInt", "LockTimeout", "LogLevel", "MultiStatementCount", "NoorderSequenceAsDefault", "OdbcTreatDecimalAsInt", "PythonProfilerModules", "PythonProfilerTargetStage", "QueryTag", "QuotedIdentifiersIgnoreCase", "RowsPerResultset", "S3StageVpceDnsName", "SearchPath", "SimulatedDataSharingConsumer", "StatementQueuedTimeoutInSeconds", "StatementTimeoutInSeconds", "StrictJsonOutput", "TimestampDayIsAlways24h", "TimestampInputFormat", "TimestampLTZOutputFormat", "TimestampNTZOutputFormat", "TimestampOutputFormat", "TimestampTypeMapping", "TimestampTZOutputFormat", "Timezone", "TimeInputFormat", "TimeOutputFormat", "TraceLevel", "TransactionAbortOnError", "TransactionDefaultIsolationLevel", "TwoDigitCenturyStart", "UnsupportedDDLAction", "UseCachedResult", "WeekOfYearPolicy", "WeekStart")) } return nil } // ObjectParameters is based on https://docs.snowflake.com/en/sql-reference/parameters#object-parameters. type ObjectParameters struct { - Catalog *string `ddl:"parameter" sql:"CATALOG"` - DataRetentionTimeInDays *int `ddl:"parameter" sql:"DATA_RETENTION_TIME_IN_DAYS"` - DefaultDDLCollation *string `ddl:"parameter,single_quotes" sql:"DEFAULT_DDL_COLLATION"` - EnableUnredactedQuerySyntaxError *bool `ddl:"parameter" sql:"ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR"` - LogLevel *LogLevel `ddl:"parameter" sql:"LOG_LEVEL"` - MaxConcurrencyLevel *int `ddl:"parameter" sql:"MAX_CONCURRENCY_LEVEL"` - MaxDataExtensionTimeInDays *int `ddl:"parameter" sql:"MAX_DATA_EXTENSION_TIME_IN_DAYS"` - PipeExecutionPaused *bool `ddl:"parameter" sql:"PIPE_EXECUTION_PAUSED"` - PreventUnloadToInternalStages *bool `ddl:"parameter" sql:"PREVENT_UNLOAD_TO_INTERNAL_STAGES"` - StatementQueuedTimeoutInSeconds *int `ddl:"parameter" sql:"STATEMENT_QUEUED_TIMEOUT_IN_SECONDS"` - StatementTimeoutInSeconds *int `ddl:"parameter" sql:"STATEMENT_TIMEOUT_IN_SECONDS"` - NetworkPolicy *string `ddl:"parameter,single_quotes" sql:"NETWORK_POLICY"` - ShareRestrictions *bool `ddl:"parameter" sql:"SHARE_RESTRICTIONS"` - SuspendTaskAfterNumFailures *int `ddl:"parameter" sql:"SUSPEND_TASK_AFTER_NUM_FAILURES"` - TraceLevel *TraceLevel `ddl:"parameter" sql:"TRACE_LEVEL"` - UserTaskManagedInitialWarehouseSize *WarehouseSize `ddl:"parameter" sql:"USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE"` - UserTaskTimeoutMs *int `ddl:"parameter" sql:"USER_TASK_TIMEOUT_MS"` + Catalog *string `ddl:"parameter" sql:"CATALOG"` + DataRetentionTimeInDays *int `ddl:"parameter" sql:"DATA_RETENTION_TIME_IN_DAYS"` + DefaultDDLCollation *string `ddl:"parameter,single_quotes" sql:"DEFAULT_DDL_COLLATION"` + EnableUnredactedQuerySyntaxError *bool `ddl:"parameter" sql:"ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR"` + LogLevel *LogLevel `ddl:"parameter" sql:"LOG_LEVEL"` + MaxConcurrencyLevel *int `ddl:"parameter" sql:"MAX_CONCURRENCY_LEVEL"` + MaxDataExtensionTimeInDays *int `ddl:"parameter" sql:"MAX_DATA_EXTENSION_TIME_IN_DAYS"` + PipeExecutionPaused *bool `ddl:"parameter" sql:"PIPE_EXECUTION_PAUSED"` + PreventUnloadToInternalStages *bool `ddl:"parameter" sql:"PREVENT_UNLOAD_TO_INTERNAL_STAGES"` + StatementQueuedTimeoutInSeconds *int `ddl:"parameter" sql:"STATEMENT_QUEUED_TIMEOUT_IN_SECONDS"` + StatementTimeoutInSeconds *int `ddl:"parameter" sql:"STATEMENT_TIMEOUT_IN_SECONDS"` + NetworkPolicy *string `ddl:"parameter,single_quotes" sql:"NETWORK_POLICY"` + ShareRestrictions *bool `ddl:"parameter" sql:"SHARE_RESTRICTIONS"` + SuspendTaskAfterNumFailures *int `ddl:"parameter" sql:"SUSPEND_TASK_AFTER_NUM_FAILURES"` + StorageSerializationPolicy *string `ddl:"parameter" sql:"STORAGE_SERIALIZATION_POLICY"` + TraceLevel *TraceLevel `ddl:"parameter" sql:"TRACE_LEVEL"` + TaskAutoRetryAttempts *int `ddl:"parameter" sql:"TASK_AUTO_RETRY_ATTEMPTS"` + UserTaskManagedInitialWarehouseSize *WarehouseSize `ddl:"parameter" sql:"USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE"` + UserTaskMinimumTriggerIntervalInSeconds *int `ddl:"parameter" sql:"USER_TASK_MINIMUM_TRIGGER_INTERVAL_IN_SECONDS"` + UserTaskTimeoutMs *int `ddl:"parameter" sql:"USER_TASK_TIMEOUT_MS"` } func (v *ObjectParameters) validate() error { var errs []error if valueSet(v.DataRetentionTimeInDays) { - if !validateIntInRange(*v.DataRetentionTimeInDays, 0, 90) { + if !validateIntInRangeInclusive(*v.DataRetentionTimeInDays, 0, 90) { errs = append(errs, errIntBetween("ObjectParameters", "DataRetentionTimeInDays", 0, 90)) } } @@ -1544,7 +1685,7 @@ func (v *ObjectParameters) validate() error { } } if valueSet(v.MaxDataExtensionTimeInDays) { - if !validateIntInRange(*v.MaxDataExtensionTimeInDays, 0, 90) { + if !validateIntInRangeInclusive(*v.MaxDataExtensionTimeInDays, 0, 90) { errs = append(errs, errIntBetween("ObjectParameters", "MaxDataExtensionTimeInDays", 0, 90)) } } @@ -1563,9 +1704,19 @@ func (v *ObjectParameters) validate() error { errs = append(errs, errIntValue("ObjectParameters", "SuspendTaskAfterNumFailures", IntErrGreaterOrEqual, 0)) } } + if valueSet(v.TaskAutoRetryAttempts) { + if !validateIntGreaterThanOrEqual(*v.TaskAutoRetryAttempts, 0) { + errs = append(errs, errIntValue("ObjectParameters", "SuspendTaskAfterNumFailures", IntErrGreaterOrEqual, 0)) + } + } + if valueSet(v.UserTaskMinimumTriggerIntervalInSeconds) { + if !validateIntGreaterThanOrEqual(*v.UserTaskMinimumTriggerIntervalInSeconds, 0) { + errs = append(errs, errIntValue("ObjectParameters", "UserTaskMinimumTriggerIntervalInSeconds", IntErrGreaterOrEqual, 0)) + } + } if valueSet(v.UserTaskTimeoutMs) { - if !validateIntInRange(*v.UserTaskTimeoutMs, 0, 86400000) { - errs = append(errs, errIntBetween("ObjectParameters", "UserTaskTimeoutMs", 0, 86400000)) + if !validateIntGreaterThanOrEqual(*v.UserTaskTimeoutMs, 0) { + errs = append(errs, errIntValue("ObjectParameters", "UserTaskTimeoutMs", IntErrGreaterOrEqual, 0)) } } return errors.Join(errs...) @@ -1586,6 +1737,8 @@ type ObjectParametersUnset struct { NetworkPolicy *bool `ddl:"keyword" sql:"NETWORK_POLICY"` ShareRestrictions *bool `ddl:"keyword" sql:"SHARE_RESTRICTIONS"` SuspendTaskAfterNumFailures *bool `ddl:"keyword" sql:"SUSPEND_TASK_AFTER_NUM_FAILURES"` + StorageSerializationPolicy *bool `ddl:"keyword" sql:"STORAGE_SERIALIZATION_POLICY"` + TaskAutoRetryAttempts *bool `ddl:"keyword" sql:"TASK_AUTO_RETRY_ATTEMPTS"` TraceLevel *bool `ddl:"keyword" sql:"TRACE_LEVEL"` UserTaskManagedInitialWarehouseSize *bool `ddl:"keyword" sql:"USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE"` UserTaskTimeoutMs *bool `ddl:"keyword" sql:"USER_TASK_TIMEOUT_MS"` diff --git a/pkg/sdk/parameters_impl.go b/pkg/sdk/parameters_impl.go index d01af6d161..80600f292e 100644 --- a/pkg/sdk/parameters_impl.go +++ b/pkg/sdk/parameters_impl.go @@ -27,12 +27,16 @@ func (sessionParameters *SessionParameters) setParam(parameter SessionParameter, switch parameter { case SessionParameterAbortDetachedQuery: err = setBooleanValue(parameter, value, &sessionParameters.AbortDetachedQuery) + case SessionParameterActivePythonProfiler: + sessionParameters.ActivePythonProfiler = Pointer(ActivePythonProfiler(value)) case SessionParameterAutocommit: err = setBooleanValue(parameter, value, &sessionParameters.Autocommit) case SessionParameterBinaryInputFormat: sessionParameters.BinaryInputFormat = Pointer(BinaryInputFormat(value)) case SessionParameterBinaryOutputFormat: sessionParameters.BinaryOutputFormat = Pointer(BinaryOutputFormat(value)) + case SessionParameterClientEnableLogInfoStatementParameters: + err = setBooleanValue(parameter, value, &sessionParameters.ClientEnableLogInfoStatementParameters) case SessionParameterClientMemoryLimit: err = setIntegerValue(parameter, value, &sessionParameters.ClientMemoryLimit) case SessionParameterClientMetadataRequestUseConnectionCtx: @@ -51,6 +55,8 @@ func (sessionParameters *SessionParameters) setParam(parameter SessionParameter, err = setIntegerValue(parameter, value, &sessionParameters.ClientSessionKeepAliveHeartbeatFrequency) case SessionParameterClientTimestampTypeMapping: sessionParameters.ClientTimestampTypeMapping = Pointer(ClientTimestampTypeMapping(value)) + case SessionParameterCsvTimestampFormat: + sessionParameters.CsvTimestampFormat = &value case SessionParameterDateInputFormat: sessionParameters.DateInputFormat = &value case SessionParameterDateOutputFormat: @@ -65,14 +71,18 @@ func (sessionParameters *SessionParameters) setParam(parameter SessionParameter, sessionParameters.GeographyOutputFormat = Pointer(GeographyOutputFormat(value)) case SessionParameterGeometryOutputFormat: sessionParameters.GeometryOutputFormat = Pointer(GeometryOutputFormat(value)) + case SessionParameterHybridTableLockTimeout: + err = setIntegerValue(parameter, value, &sessionParameters.HybridTableLockTimeout) case SessionParameterJdbcTreatDecimalAsInt: err = setBooleanValue(parameter, value, &sessionParameters.JdbcTreatDecimalAsInt) case SessionParameterJdbcTreatTimestampNtzAsUtc: err = setBooleanValue(parameter, value, &sessionParameters.JdbcTreatTimestampNtzAsUtc) case SessionParameterJdbcUseSessionTimezone: err = setBooleanValue(parameter, value, &sessionParameters.JdbcUseSessionTimezone) - case SessionParameterJSONIndent: - err = setIntegerValue(parameter, value, &sessionParameters.JSONIndent) + case SessionParameterJsonIndent: + err = setIntegerValue(parameter, value, &sessionParameters.JsonIndent) + case SessionParameterJsTreatIntegerAsBigInt: + err = setBooleanValue(parameter, value, &sessionParameters.JsTreatIntegerAsBigInt) case SessionParameterLockTimeout: err = setIntegerValue(parameter, value, &sessionParameters.LockTimeout) case SessionParameterLogLevel: @@ -83,6 +93,10 @@ func (sessionParameters *SessionParameters) setParam(parameter SessionParameter, err = setBooleanValue(parameter, value, &sessionParameters.NoorderSequenceAsDefault) case SessionParameterOdbcTreatDecimalAsInt: err = setBooleanValue(parameter, value, &sessionParameters.OdbcTreatDecimalAsInt) + case SessionParameterPythonProfilerModules: + sessionParameters.PythonProfilerModules = &value + case SessionParameterPythonProfilerTargetStage: + sessionParameters.PythonProfilerTargetStage = &value case SessionParameterQueryTag: sessionParameters.QueryTag = &value case SessionParameterQuotedIdentifiersIgnoreCase: @@ -99,8 +113,8 @@ func (sessionParameters *SessionParameters) setParam(parameter SessionParameter, err = setIntegerValue(parameter, value, &sessionParameters.StatementQueuedTimeoutInSeconds) case SessionParameterStatementTimeoutInSeconds: err = setIntegerValue(parameter, value, &sessionParameters.StatementTimeoutInSeconds) - case SessionParameterStrictJSONOutput: - err = setBooleanValue(parameter, value, &sessionParameters.StrictJSONOutput) + case SessionParameterStrictJsonOutput: + err = setBooleanValue(parameter, value, &sessionParameters.StrictJsonOutput) case SessionParameterTimestampDayIsAlways24h: err = setBooleanValue(parameter, value, &sessionParameters.TimestampDayIsAlways24h) case SessionParameterTimestampInputFormat: @@ -177,12 +191,16 @@ func (sessionParametersUnset *SessionParametersUnset) setParam(parameter Session switch parameter { case SessionParameterAbortDetachedQuery: unsetField = &sessionParametersUnset.AbortDetachedQuery + case SessionParameterActivePythonProfiler: + unsetField = &sessionParametersUnset.ActivePythonProfiler case SessionParameterAutocommit: unsetField = &sessionParametersUnset.Autocommit case SessionParameterBinaryInputFormat: unsetField = &sessionParametersUnset.BinaryInputFormat case SessionParameterBinaryOutputFormat: unsetField = &sessionParametersUnset.BinaryOutputFormat + case SessionParameterClientEnableLogInfoStatementParameters: + unsetField = &sessionParametersUnset.ClientEnableLogInfoStatementParameters case SessionParameterClientMemoryLimit: unsetField = &sessionParametersUnset.ClientMemoryLimit case SessionParameterClientMetadataRequestUseConnectionCtx: @@ -201,6 +219,8 @@ func (sessionParametersUnset *SessionParametersUnset) setParam(parameter Session unsetField = &sessionParametersUnset.ClientSessionKeepAliveHeartbeatFrequency case SessionParameterClientTimestampTypeMapping: unsetField = &sessionParametersUnset.ClientTimestampTypeMapping + case SessionParameterCsvTimestampFormat: + unsetField = &sessionParametersUnset.CsvTimestampFormat case SessionParameterDateInputFormat: unsetField = &sessionParametersUnset.DateInputFormat case SessionParameterDateOutputFormat: @@ -215,14 +235,18 @@ func (sessionParametersUnset *SessionParametersUnset) setParam(parameter Session unsetField = &sessionParametersUnset.GeographyOutputFormat case SessionParameterGeometryOutputFormat: unsetField = &sessionParametersUnset.GeometryOutputFormat + case SessionParameterHybridTableLockTimeout: + unsetField = &sessionParametersUnset.HybridTableLockTimeout case SessionParameterJdbcTreatDecimalAsInt: unsetField = &sessionParametersUnset.JdbcTreatDecimalAsInt case SessionParameterJdbcTreatTimestampNtzAsUtc: unsetField = &sessionParametersUnset.JdbcTreatTimestampNtzAsUtc case SessionParameterJdbcUseSessionTimezone: unsetField = &sessionParametersUnset.JdbcUseSessionTimezone - case SessionParameterJSONIndent: - unsetField = &sessionParametersUnset.JSONIndent + case SessionParameterJsonIndent: + unsetField = &sessionParametersUnset.JsonIndent + case SessionParameterJsTreatIntegerAsBigInt: + unsetField = &sessionParametersUnset.JsTreatIntegerAsBigInt case SessionParameterLockTimeout: unsetField = &sessionParametersUnset.LockTimeout case SessionParameterLogLevel: @@ -233,6 +257,10 @@ func (sessionParametersUnset *SessionParametersUnset) setParam(parameter Session unsetField = &sessionParametersUnset.NoorderSequenceAsDefault case SessionParameterOdbcTreatDecimalAsInt: unsetField = &sessionParametersUnset.OdbcTreatDecimalAsInt + case SessionParameterPythonProfilerModules: + unsetField = &sessionParametersUnset.PythonProfilerModules + case SessionParameterPythonProfilerTargetStage: + unsetField = &sessionParametersUnset.PythonProfilerTargetStage case SessionParameterQueryTag: unsetField = &sessionParametersUnset.QueryTag case SessionParameterQuotedIdentifiersIgnoreCase: @@ -249,8 +277,8 @@ func (sessionParametersUnset *SessionParametersUnset) setParam(parameter Session unsetField = &sessionParametersUnset.StatementQueuedTimeoutInSeconds case SessionParameterStatementTimeoutInSeconds: unsetField = &sessionParametersUnset.StatementTimeoutInSeconds - case SessionParameterStrictJSONOutput: - unsetField = &sessionParametersUnset.StrictJSONOutput + case SessionParameterStrictJsonOutput: + unsetField = &sessionParametersUnset.StrictJsonOutput case SessionParameterTimestampDayIsAlways24h: unsetField = &sessionParametersUnset.TimestampDayIsAlways24h case SessionParameterTimestampInputFormat: diff --git a/pkg/sdk/parameters_impl_test.go b/pkg/sdk/parameters_impl_test.go index d235a42a5e..b8859154d2 100644 --- a/pkg/sdk/parameters_impl_test.go +++ b/pkg/sdk/parameters_impl_test.go @@ -15,9 +15,11 @@ func TestSessionParameters_setParam(t *testing.T) { accessor func(*SessionParameters) any }{ {parameter: SessionParameterAbortDetachedQuery, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.AbortDetachedQuery }}, + {parameter: SessionParameterActivePythonProfiler, value: "LINE", expectedValue: ActivePythonProfilerLine, accessor: func(sp *SessionParameters) any { return *sp.ActivePythonProfiler }}, {parameter: SessionParameterAutocommit, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.Autocommit }}, {parameter: SessionParameterBinaryInputFormat, value: "some", expectedValue: BinaryInputFormat("some"), accessor: func(sp *SessionParameters) any { return *sp.BinaryInputFormat }}, {parameter: SessionParameterBinaryOutputFormat, value: "some", expectedValue: BinaryOutputFormat("some"), accessor: func(sp *SessionParameters) any { return *sp.BinaryOutputFormat }}, + {parameter: SessionParameterClientEnableLogInfoStatementParameters, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.ClientEnableLogInfoStatementParameters }}, {parameter: SessionParameterClientMemoryLimit, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.ClientMemoryLimit }}, {parameter: SessionParameterClientMetadataRequestUseConnectionCtx, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.ClientMetadataRequestUseConnectionCtx }}, {parameter: SessionParameterClientPrefetchThreads, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.ClientPrefetchThreads }}, @@ -27,6 +29,7 @@ func TestSessionParameters_setParam(t *testing.T) { {parameter: SessionParameterClientSessionKeepAlive, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.ClientSessionKeepAlive }}, {parameter: SessionParameterClientSessionKeepAliveHeartbeatFrequency, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.ClientSessionKeepAliveHeartbeatFrequency }}, {parameter: SessionParameterClientTimestampTypeMapping, value: "some", expectedValue: ClientTimestampTypeMapping("some"), accessor: func(sp *SessionParameters) any { return *sp.ClientTimestampTypeMapping }}, + {parameter: SessionParameterCsvTimestampFormat, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.CsvTimestampFormat }}, {parameter: SessionParameterDateInputFormat, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.DateInputFormat }}, {parameter: SessionParameterDateOutputFormat, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.DateOutputFormat }}, {parameter: SessionParameterEnableUnloadPhysicalTypeOptimization, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.EnableUnloadPhysicalTypeOptimization }}, @@ -34,15 +37,19 @@ func TestSessionParameters_setParam(t *testing.T) { {parameter: SessionParameterErrorOnNondeterministicUpdate, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.ErrorOnNondeterministicUpdate }}, {parameter: SessionParameterGeographyOutputFormat, value: "some", expectedValue: GeographyOutputFormat("some"), accessor: func(sp *SessionParameters) any { return *sp.GeographyOutputFormat }}, {parameter: SessionParameterGeometryOutputFormat, value: "some", expectedValue: GeometryOutputFormat("some"), accessor: func(sp *SessionParameters) any { return *sp.GeometryOutputFormat }}, + {parameter: SessionParameterHybridTableLockTimeout, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.HybridTableLockTimeout }}, {parameter: SessionParameterJdbcTreatDecimalAsInt, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.JdbcTreatDecimalAsInt }}, {parameter: SessionParameterJdbcTreatTimestampNtzAsUtc, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.JdbcTreatTimestampNtzAsUtc }}, {parameter: SessionParameterJdbcUseSessionTimezone, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.JdbcUseSessionTimezone }}, - {parameter: SessionParameterJSONIndent, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.JSONIndent }}, + {parameter: SessionParameterJsonIndent, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.JsonIndent }}, + {parameter: SessionParameterJsTreatIntegerAsBigInt, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.JsTreatIntegerAsBigInt }}, {parameter: SessionParameterLockTimeout, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.LockTimeout }}, {parameter: SessionParameterLogLevel, value: "some", expectedValue: LogLevel("some"), accessor: func(sp *SessionParameters) any { return *sp.LogLevel }}, {parameter: SessionParameterMultiStatementCount, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.MultiStatementCount }}, {parameter: SessionParameterNoorderSequenceAsDefault, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.NoorderSequenceAsDefault }}, {parameter: SessionParameterOdbcTreatDecimalAsInt, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.OdbcTreatDecimalAsInt }}, + {parameter: SessionParameterPythonProfilerModules, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.PythonProfilerModules }}, + {parameter: SessionParameterPythonProfilerTargetStage, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.PythonProfilerTargetStage }}, {parameter: SessionParameterQueryTag, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.QueryTag }}, {parameter: SessionParameterQuotedIdentifiersIgnoreCase, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.QuotedIdentifiersIgnoreCase }}, {parameter: SessionParameterRowsPerResultset, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.RowsPerResultset }}, @@ -51,7 +58,7 @@ func TestSessionParameters_setParam(t *testing.T) { {parameter: SessionParameterSimulatedDataSharingConsumer, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.SimulatedDataSharingConsumer }}, {parameter: SessionParameterStatementQueuedTimeoutInSeconds, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.StatementQueuedTimeoutInSeconds }}, {parameter: SessionParameterStatementTimeoutInSeconds, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.StatementTimeoutInSeconds }}, - {parameter: SessionParameterStrictJSONOutput, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.StrictJSONOutput }}, + {parameter: SessionParameterStrictJsonOutput, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.StrictJsonOutput }}, {parameter: SessionParameterTimestampDayIsAlways24h, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.TimestampDayIsAlways24h }}, {parameter: SessionParameterTimestampInputFormat, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.TimestampInputFormat }}, {parameter: SessionParameterTimestampLTZOutputFormat, value: "some", expectedValue: "some", accessor: func(sp *SessionParameters) any { return *sp.TimestampLTZOutputFormat }}, @@ -98,7 +105,7 @@ func TestSessionParameters_setParam(t *testing.T) { // {parameter: SessionParameterDateOutputFormat, value: "some"}, // add validation {parameter: SessionParameterErrorOnNondeterministicMerge, value: "true123"}, {parameter: SessionParameterErrorOnNondeterministicUpdate, value: "true123"}, - {parameter: SessionParameterJSONIndent, value: "aaa"}, + {parameter: SessionParameterJsonIndent, value: "aaa"}, {parameter: SessionParameterLockTimeout, value: "aaa"}, {parameter: SessionParameterMultiStatementCount, value: "aaa"}, // {parameter: SessionParameterQueryTag, value: "some"}, // add validation @@ -106,7 +113,7 @@ func TestSessionParameters_setParam(t *testing.T) { {parameter: SessionParameterRowsPerResultset, value: "aaa"}, // {parameter: SessionParameterSimulatedDataSharingConsumer, value: "some"}, // add validation {parameter: SessionParameterStatementTimeoutInSeconds, value: "aaa"}, - {parameter: SessionParameterStrictJSONOutput, value: "true123"}, + {parameter: SessionParameterStrictJsonOutput, value: "true123"}, // {parameter: SessionParameterTimeInputFormat, value: "some"}, // add validation // {parameter: SessionParameterTimeOutputFormat, value: "some"}, // add validation {parameter: SessionParameterTimestampDayIsAlways24h, value: "true123"}, diff --git a/pkg/sdk/parameters_test.go b/pkg/sdk/parameters_test.go index a288f9eee5..93592e1f1e 100644 --- a/pkg/sdk/parameters_test.go +++ b/pkg/sdk/parameters_test.go @@ -68,10 +68,13 @@ func TestToAccountParameter(t *testing.T) { {input: "ALLOW_CLIENT_MFA_CACHING", want: AccountParameterAllowClientMFACaching}, {input: "ALLOW_ID_TOKEN", want: AccountParameterAllowIDToken}, {input: "CLIENT_ENCRYPTION_KEY_SIZE", want: AccountParameterClientEncryptionKeySize}, + {input: "CORTEX_ENABLED_CROSS_REGION", want: AccountParameterCortexEnabledCrossRegion}, {input: "ENABLE_IDENTIFIER_FIRST_LOGIN", want: AccountParameterEnableIdentifierFirstLogin}, {input: "ENABLE_INTERNAL_STAGES_PRIVATELINK", want: AccountParameterEnableInternalStagesPrivatelink}, {input: "ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_IMAGE_REPOSITORY", want: AccountParameterEnableTriSecretAndRekeyOptOutForImageRepository}, {input: "ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_SPCS_BLOCK_STORAGE", want: AccountParameterEnableTriSecretAndRekeyOptOutForSpcsBlockStorage}, + {input: "ENABLE_UNHANDLED_EXCEPTIONS_REPORTING", want: AccountParameterEnableUnhandledExceptionsReporting}, + {input: "ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES", want: AccountParameterEnforceNetworkRulesForInternalStages}, {input: "EVENT_TABLE", want: AccountParameterEventTable}, {input: "EXTERNAL_OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST", want: AccountParameterExternalOAuthAddPrivilegedRolesToBlockedList}, {input: "INITIAL_REPLICATION_SIZE_LIMIT_IN_TB", want: AccountParameterInitialReplicationSizeLimitInTB}, @@ -81,32 +84,53 @@ func TestToAccountParameter(t *testing.T) { {input: "PERIODIC_DATA_REKEYING", want: AccountParameterPeriodicDataRekeying}, {input: "PREVENT_LOAD_FROM_INLINE_URL", want: AccountParameterPreventLoadFromInlineURL}, {input: "PREVENT_UNLOAD_TO_INLINE_URL", want: AccountParameterPreventUnloadToInlineURL}, - {input: "PREVENT_UNLOAD_TO_INTERNAL_STAGES", want: AccountParameterPreventUnloadToInternalStages}, {input: "REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION", want: AccountParameterRequireStorageIntegrationForStageCreation}, {input: "REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION", want: AccountParameterRequireStorageIntegrationForStageOperation}, {input: "SSO_LOGIN_PAGE", want: AccountParameterSSOLoginPage}, + + // Session Parameters (inherited) {input: "ABORT_DETACHED_QUERY", want: AccountParameterAbortDetachedQuery}, + {input: "ACTIVE_PYTHON_PROFILER", want: AccountParameterActivePythonProfiler}, {input: "AUTOCOMMIT", want: AccountParameterAutocommit}, {input: "BINARY_INPUT_FORMAT", want: AccountParameterBinaryInputFormat}, {input: "BINARY_OUTPUT_FORMAT", want: AccountParameterBinaryOutputFormat}, + {input: "CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS", want: AccountParameterClientEnableLogInfoStatementParameters}, + {input: "CLIENT_MEMORY_LIMIT", want: AccountParameterClientMemoryLimit}, {input: "CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX", want: AccountParameterClientMetadataRequestUseConnectionCtx}, {input: "CLIENT_METADATA_USE_SESSION_DATABASE", want: AccountParameterClientMetadataUseSessionDatabase}, + {input: "CLIENT_PREFETCH_THREADS", want: AccountParameterClientPrefetchThreads}, + {input: "CLIENT_RESULT_CHUNK_SIZE", want: AccountParameterClientResultChunkSize}, {input: "CLIENT_RESULT_COLUMN_CASE_INSENSITIVE", want: AccountParameterClientResultColumnCaseInsensitive}, + {input: "CLIENT_SESSION_KEEP_ALIVE", want: AccountParameterClientSessionKeepAlive}, + {input: "CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY", want: AccountParameterClientSessionKeepAliveHeartbeatFrequency}, + {input: "CLIENT_TIMESTAMP_TYPE_MAPPING", want: AccountParameterClientTimestampTypeMapping}, + {input: "CSV_TIMESTAMP_FORMAT", want: AccountParameterCsvTimestampFormat}, {input: "DATE_INPUT_FORMAT", want: AccountParameterDateInputFormat}, {input: "DATE_OUTPUT_FORMAT", want: AccountParameterDateOutputFormat}, + {input: "ENABLE_UNLOAD_PHYSICAL_TYPE_OPTIMIZATION", want: AccountParameterEnableUnloadPhysicalTypeOptimization}, {input: "ERROR_ON_NONDETERMINISTIC_MERGE", want: AccountParameterErrorOnNondeterministicMerge}, {input: "ERROR_ON_NONDETERMINISTIC_UPDATE", want: AccountParameterErrorOnNondeterministicUpdate}, {input: "GEOGRAPHY_OUTPUT_FORMAT", want: AccountParameterGeographyOutputFormat}, - {input: "JSON_INDENT", want: AccountParameterJSONIndent}, + {input: "GEOMETRY_OUTPUT_FORMAT", want: AccountParameterGeometryOutputFormat}, + {input: "HYBRID_TABLE_LOCK_TIMEOUT", want: AccountParameterHybridTableLockTimeout}, + {input: "JDBC_TREAT_DECIMAL_AS_INT", want: AccountParameterJdbcTreatDecimalAsInt}, + {input: "JDBC_TREAT_TIMESTAMP_NTZ_AS_UTC", want: AccountParameterJdbcTreatTimestampNtzAsUtc}, + {input: "JDBC_USE_SESSION_TIMEZONE", want: AccountParameterJdbcUseSessionTimezone}, + {input: "JSON_INDENT", want: AccountParameterJsonIndent}, + {input: "JS_TREAT_INTEGER_AS_BIGINT", want: AccountParameterJsTreatIntegerAsBigInt}, {input: "LOCK_TIMEOUT", want: AccountParameterLockTimeout}, {input: "MULTI_STATEMENT_COUNT", want: AccountParameterMultiStatementCount}, + {input: "NOORDER_SEQUENCE_AS_DEFAULT", want: AccountParameterNoorderSequenceAsDefault}, + {input: "ODBC_TREAT_DECIMAL_AS_INT", want: AccountParameterOdbcTreatDecimalAsInt}, + {input: "PYTHON_PROFILER_MODULES", want: AccountParameterPythonProfilerModules}, + {input: "PYTHON_PROFILER_TARGET_STAGE", want: AccountParameterPythonProfilerTargetStage}, {input: "QUERY_TAG", want: AccountParameterQueryTag}, {input: "QUOTED_IDENTIFIERS_IGNORE_CASE", want: AccountParameterQuotedIdentifiersIgnoreCase}, {input: "ROWS_PER_RESULTSET", want: AccountParameterRowsPerResultset}, {input: "S3_STAGE_VPCE_DNS_NAME", want: AccountParameterS3StageVpceDnsName}, + {input: "SEARCH_PATH", want: AccountParameterSearchPath}, {input: "SIMULATED_DATA_SHARING_CONSUMER", want: AccountParameterSimulatedDataSharingConsumer}, - {input: "STATEMENT_TIMEOUT_IN_SECONDS", want: AccountParameterStatementTimeoutInSeconds}, - {input: "STRICT_JSON_OUTPUT", want: AccountParameterStrictJSONOutput}, + {input: "STRICT_JSON_OUTPUT", want: AccountParameterStrictJsonOutput}, {input: "TIME_INPUT_FORMAT", want: AccountParameterTimeInputFormat}, {input: "TIME_OUTPUT_FORMAT", want: AccountParameterTimeOutputFormat}, {input: "TIMESTAMP_DAY_IS_ALWAYS_24H", want: AccountParameterTimestampDayIsAlways24h}, @@ -124,6 +148,8 @@ func TestToAccountParameter(t *testing.T) { {input: "USE_CACHED_RESULT", want: AccountParameterUseCachedResult}, {input: "WEEK_OF_YEAR_POLICY", want: AccountParameterWeekOfYearPolicy}, {input: "WEEK_START", want: AccountParameterWeekStart}, + + // Object Parameters (inherited) {input: "CATALOG", want: AccountParameterCatalog}, {input: "DATA_RETENTION_TIME_IN_DAYS", want: AccountParameterDataRetentionTimeInDays}, {input: "DEFAULT_DDL_COLLATION", want: AccountParameterDefaultDDLCollation}, @@ -134,6 +160,7 @@ func TestToAccountParameter(t *testing.T) { {input: "PIPE_EXECUTION_PAUSED", want: AccountParameterPipeExecutionPaused}, {input: "REPLACE_INVALID_CHARACTERS", want: AccountParameterReplaceInvalidCharacters}, {input: "STATEMENT_QUEUED_TIMEOUT_IN_SECONDS", want: AccountParameterStatementQueuedTimeoutInSeconds}, + {input: "STATEMENT_TIMEOUT_IN_SECONDS", want: AccountParameterStatementTimeoutInSeconds}, {input: "STORAGE_SERIALIZATION_POLICY", want: AccountParameterStorageSerializationPolicy}, {input: "SHARE_RESTRICTIONS", want: AccountParameterShareRestrictions}, {input: "SUSPEND_TASK_AFTER_NUM_FAILURES", want: AccountParameterSuspendTaskAfterNumFailures}, @@ -144,7 +171,11 @@ func TestToAccountParameter(t *testing.T) { {input: "USER_TASK_MINIMUM_TRIGGER_INTERVAL_IN_SECONDS", want: AccountParameterUserTaskMinimumTriggerIntervalInSeconds}, {input: "METRIC_LEVEL", want: AccountParameterMetricLevel}, {input: "ENABLE_CONSOLE_OUTPUT", want: AccountParameterEnableConsoleOutput}, + + // User Parameters (inherited) + {input: "ENABLE_PERSONAL_DATABASE", want: AccountParameterEnablePersonalDatabase}, {input: "ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR", want: AccountParameterEnableUnredactedQuerySyntaxError}, + {input: "PREVENT_UNLOAD_TO_INTERNAL_STAGES", want: AccountParameterPreventUnloadToInternalStages}, } invalid := []test{ diff --git a/pkg/sdk/tags_validations.go b/pkg/sdk/tags_validations.go index 25a219c533..2d01814df5 100644 --- a/pkg/sdk/tags_validations.go +++ b/pkg/sdk/tags_validations.go @@ -36,7 +36,7 @@ func (opts *createTagOptions) validate() error { } func (v *AllowedValues) validate() error { - if !validateIntInRange(len(v.Values), 1, 300) { + if !validateIntInRangeInclusive(len(v.Values), 1, 300) { return errIntBetween("AllowedValues", "Values", 1, 300) } return nil diff --git a/pkg/sdk/tasks_gen_test.go b/pkg/sdk/tasks_gen_test.go index 9422d73824..56b8fe4c6f 100644 --- a/pkg/sdk/tasks_gen_test.go +++ b/pkg/sdk/tasks_gen_test.go @@ -45,9 +45,9 @@ func TestTasks_Create(t *testing.T) { t.Run("validation: opts.SessionParameters.SessionParameters should be valid", func(t *testing.T) { opts := defaultOpts() opts.SessionParameters = &SessionParameters{ - JSONIndent: Int(25), + JsonIndent: Int(-1), } - assertOptsInvalidJoinedErrors(t, opts, errIntBetween("SessionParameters", "JSONIndent", 0, 16)) + assertOptsInvalidJoinedErrors(t, opts, errIntValue("SessionParameters", "JsonIndent", IntErrGreaterOrEqual, 0)) }) t.Run("basic", func(t *testing.T) { @@ -78,7 +78,7 @@ func TestTasks_Create(t *testing.T) { opts.Config = String(`$${"output_dir": "/temp/test_directory/", "learning_rate": 0.1}$$`) opts.AllowOverlappingExecution = Bool(true) opts.SessionParameters = &SessionParameters{ - JSONIndent: Int(10), + JsonIndent: Int(10), LockTimeout: Int(5), } opts.UserTaskTimeoutMs = Int(5) @@ -131,7 +131,7 @@ func TestTasks_CreateOrAlter(t *testing.T) { t.Run("validation: opts.SessionParameters.SessionParameters should be valid", func(t *testing.T) { opts := defaultOpts() opts.SessionParameters = &SessionParameters{ - JSONIndent: Int(25), + JsonIndent: Int(25), } assertOptsInvalidJoinedErrors(t, opts, errIntBetween("SessionParameters", "JSONIndent", 0, 16)) }) @@ -155,7 +155,7 @@ func TestTasks_CreateOrAlter(t *testing.T) { opts.AllowOverlappingExecution = Bool(true) opts.UserTaskTimeoutMs = Int(5) opts.SessionParameters = &SessionParameters{ - JSONIndent: Int(10), + JsonIndent: Int(10), LockTimeout: Int(5), } opts.SuspendTaskAfterNumFailures = Int(6) @@ -265,7 +265,7 @@ func TestTasks_Alter(t *testing.T) { opts := defaultOpts() opts.Set = &TaskSet{} opts.Set.SessionParameters = &SessionParameters{ - JSONIndent: Int(25), + JsonIndent: Int(25), } assertOptsInvalidJoinedErrors(t, opts, errIntBetween("SessionParameters", "JSONIndent", 0, 16)) }) @@ -337,7 +337,7 @@ func TestTasks_Alter(t *testing.T) { opts := defaultOpts() opts.Set = &TaskSet{ SessionParameters: &SessionParameters{ - JSONIndent: Int(15), + JsonIndent: Int(15), }, } assertOptsValidAndSQLEquals(t, opts, "ALTER TASK %s SET JSON_INDENT = 15", id.FullyQualifiedName()) diff --git a/pkg/sdk/testint/accounts_integration_test.go b/pkg/sdk/testint/accounts_integration_test.go index 6ed6b1ac5d..f2e646073d 100644 --- a/pkg/sdk/testint/accounts_integration_test.go +++ b/pkg/sdk/testint/accounts_integration_test.go @@ -457,7 +457,7 @@ func TestInt_Account_SelfAlter(t *testing.T) { require.NotEmpty(t, parameters) assertParameterIsDefault(t, parameters, string(sdk.AccountParameterMinDataRetentionTimeInDays)) - assertParameterIsDefault(t, parameters, string(sdk.AccountParameterJSONIndent)) + assertParameterIsDefault(t, parameters, string(sdk.AccountParameterJsonIndent)) assertParameterIsDefault(t, parameters, string(sdk.AccountParameterUserTaskTimeoutMs)) assertParameterIsDefault(t, parameters, string(sdk.AccountParameterEnableUnredactedQuerySyntaxError)) @@ -468,7 +468,7 @@ func TestInt_Account_SelfAlter(t *testing.T) { MinDataRetentionTimeInDays: sdk.Int(15), // default is 0 }, SessionParameters: &sdk.SessionParameters{ - JSONIndent: sdk.Int(8), // default is 2 + JsonIndent: sdk.Int(8), // default is 2 }, ObjectParameters: &sdk.ObjectParameters{ UserTaskTimeoutMs: sdk.Int(100), // default is 3600000 @@ -486,7 +486,7 @@ func TestInt_Account_SelfAlter(t *testing.T) { require.NotEmpty(t, parameters) assertParameterValueSetOnAccount(t, parameters, string(sdk.AccountParameterMinDataRetentionTimeInDays), "15") - assertParameterValueSetOnAccount(t, parameters, string(sdk.AccountParameterJSONIndent), "8") + assertParameterValueSetOnAccount(t, parameters, string(sdk.AccountParameterJsonIndent), "8") assertParameterValueSetOnAccount(t, parameters, string(sdk.AccountParameterUserTaskTimeoutMs), "100") assertParameterValueSetOnAccount(t, parameters, string(sdk.AccountParameterEnableUnredactedQuerySyntaxError), "true") @@ -497,7 +497,7 @@ func TestInt_Account_SelfAlter(t *testing.T) { MinDataRetentionTimeInDays: sdk.Bool(true), }, SessionParameters: &sdk.SessionParametersUnset{ - JSONIndent: sdk.Bool(true), + JsonIndent: sdk.Bool(true), }, ObjectParameters: &sdk.ObjectParametersUnset{ UserTaskTimeoutMs: sdk.Bool(true), @@ -515,7 +515,7 @@ func TestInt_Account_SelfAlter(t *testing.T) { require.NotEmpty(t, parameters) assertParameterIsDefault(t, parameters, string(sdk.AccountParameterMinDataRetentionTimeInDays)) - assertParameterIsDefault(t, parameters, string(sdk.AccountParameterJSONIndent)) + assertParameterIsDefault(t, parameters, string(sdk.AccountParameterJsonIndent)) assertParameterIsDefault(t, parameters, string(sdk.AccountParameterUserTaskTimeoutMs)) assertParameterIsDefault(t, parameters, string(sdk.AccountParameterEnableUnredactedQuerySyntaxError)) }) diff --git a/pkg/sdk/testint/procedures_integration_test.go b/pkg/sdk/testint/procedures_integration_test.go index b0a935f070..1b31107ddd 100644 --- a/pkg/sdk/testint/procedures_integration_test.go +++ b/pkg/sdk/testint/procedures_integration_test.go @@ -2093,7 +2093,7 @@ def filter_by_role(session, table_name, role): assert.Equal(t, "(x FLOAT)", *pairs["signature"]) assert.Equal(t, "FLOAT", *pairs["returns"]) assert.Equal(t, "SQL", *pairs["language"]) - assert.Equal(t, "\nBEGIN\n\tRETURN 3.141592654::FLOAT;\nEND;\n", *pairs["body"]) + assert.Equal(t, "BEGIN\n RETURN 3.141592654::FLOAT;\nEND;\n", *pairs["body"]) assert.Equal(t, "OWNER", *pairs["execute as"]) }) diff --git a/pkg/sdk/testint/tasks_gen_integration_test.go b/pkg/sdk/testint/tasks_gen_integration_test.go index 6304a830d4..5efdade6de 100644 --- a/pkg/sdk/testint/tasks_gen_integration_test.go +++ b/pkg/sdk/testint/tasks_gen_integration_test.go @@ -142,7 +142,7 @@ func TestInt_Tasks(t *testing.T) { GeometryOutputFormat: sdk.Pointer(sdk.GeometryOutputFormatWKB), JdbcTreatTimestampNtzAsUtc: sdk.Bool(true), JdbcUseSessionTimezone: sdk.Bool(false), - JSONIndent: sdk.Int(4), + JsonIndent: sdk.Int(4), LockTimeout: sdk.Int(21222), LogLevel: sdk.Pointer(sdk.LogLevelError), MultiStatementCount: sdk.Int(0), @@ -155,7 +155,7 @@ func TestInt_Tasks(t *testing.T) { SearchPath: sdk.String("$public, $current"), StatementQueuedTimeoutInSeconds: sdk.Int(10), StatementTimeoutInSeconds: sdk.Int(10), - StrictJSONOutput: sdk.Bool(true), + StrictJsonOutput: sdk.Bool(true), TimestampDayIsAlways24h: sdk.Bool(true), TimestampInputFormat: sdk.String("YYYY-MM-DD"), TimestampLTZOutputFormat: sdk.String("YYYY-MM-DD HH24:MI:SS"), @@ -276,7 +276,7 @@ func TestInt_Tasks(t *testing.T) { WithConfig(`{"output_dir": "/temp/test_directory/", "learning_rate": 0.1}`). WithAllowOverlappingExecution(true). WithSessionParameters(sdk.SessionParameters{ - JSONIndent: sdk.Int(4), + JsonIndent: sdk.Int(4), }). WithUserTaskTimeoutMs(500). WithSuspendTaskAfterNumFailures(3). @@ -667,7 +667,7 @@ func TestInt_Tasks(t *testing.T) { GeometryOutputFormat: sdk.Bool(true), JdbcTreatTimestampNtzAsUtc: sdk.Bool(true), JdbcUseSessionTimezone: sdk.Bool(true), - JSONIndent: sdk.Bool(true), + JsonIndent: sdk.Bool(true), LockTimeout: sdk.Bool(true), LogLevel: sdk.Bool(true), MultiStatementCount: sdk.Bool(true), @@ -680,7 +680,7 @@ func TestInt_Tasks(t *testing.T) { SearchPath: sdk.Bool(true), StatementQueuedTimeoutInSeconds: sdk.Bool(true), StatementTimeoutInSeconds: sdk.Bool(true), - StrictJSONOutput: sdk.Bool(true), + StrictJsonOutput: sdk.Bool(true), TimestampDayIsAlways24h: sdk.Bool(true), TimestampInputFormat: sdk.Bool(true), TimestampLTZOutputFormat: sdk.Bool(true), diff --git a/pkg/sdk/testint/users_integration_test.go b/pkg/sdk/testint/users_integration_test.go index 87dc57819a..cc884d6cc8 100644 --- a/pkg/sdk/testint/users_integration_test.go +++ b/pkg/sdk/testint/users_integration_test.go @@ -774,7 +774,7 @@ func TestInt_Users(t *testing.T) { JdbcTreatDecimalAsInt: sdk.Bool(false), JdbcTreatTimestampNtzAsUtc: sdk.Bool(true), JdbcUseSessionTimezone: sdk.Bool(false), - JSONIndent: sdk.Int(4), + JsonIndent: sdk.Int(4), LockTimeout: sdk.Int(21222), LogLevel: sdk.Pointer(sdk.LogLevelError), MultiStatementCount: sdk.Int(0), @@ -788,7 +788,7 @@ func TestInt_Users(t *testing.T) { SimulatedDataSharingConsumer: sdk.String("some_consumer"), StatementQueuedTimeoutInSeconds: sdk.Int(10), StatementTimeoutInSeconds: sdk.Int(10), - StrictJSONOutput: sdk.Bool(true), + StrictJsonOutput: sdk.Bool(true), TimestampDayIsAlways24h: sdk.Bool(true), TimestampInputFormat: sdk.String("YYYY-MM-DD"), TimestampLTZOutputFormat: sdk.String("YYYY-MM-DD HH24:MI:SS"), @@ -1406,7 +1406,7 @@ func TestInt_Users(t *testing.T) { JdbcTreatDecimalAsInt: sdk.Bool(false), JdbcTreatTimestampNtzAsUtc: sdk.Bool(true), JdbcUseSessionTimezone: sdk.Bool(false), - JSONIndent: sdk.Int(4), + JsonIndent: sdk.Int(4), LockTimeout: sdk.Int(21222), LogLevel: sdk.Pointer(sdk.LogLevelError), MultiStatementCount: sdk.Int(0), @@ -1420,7 +1420,7 @@ func TestInt_Users(t *testing.T) { SimulatedDataSharingConsumer: sdk.String("some_consumer"), StatementQueuedTimeoutInSeconds: sdk.Int(10), StatementTimeoutInSeconds: sdk.Int(10), - StrictJSONOutput: sdk.Bool(true), + StrictJsonOutput: sdk.Bool(true), TimestampDayIsAlways24h: sdk.Bool(true), TimestampInputFormat: sdk.String("YYYY-MM-DD"), TimestampLTZOutputFormat: sdk.String("YYYY-MM-DD HH24:MI:SS"), @@ -1483,7 +1483,7 @@ func TestInt_Users(t *testing.T) { JdbcTreatDecimalAsInt: sdk.Bool(true), JdbcTreatTimestampNtzAsUtc: sdk.Bool(true), JdbcUseSessionTimezone: sdk.Bool(true), - JSONIndent: sdk.Bool(true), + JsonIndent: sdk.Bool(true), LockTimeout: sdk.Bool(true), LogLevel: sdk.Bool(true), MultiStatementCount: sdk.Bool(true), @@ -1497,7 +1497,7 @@ func TestInt_Users(t *testing.T) { SimulatedDataSharingConsumer: sdk.Bool(true), StatementQueuedTimeoutInSeconds: sdk.Bool(true), StatementTimeoutInSeconds: sdk.Bool(true), - StrictJSONOutput: sdk.Bool(true), + StrictJsonOutput: sdk.Bool(true), TimestampDayIsAlways24h: sdk.Bool(true), TimestampInputFormat: sdk.Bool(true), TimestampLTZOutputFormat: sdk.Bool(true), @@ -1732,7 +1732,7 @@ func TestInt_Users(t *testing.T) { JdbcTreatDecimalAsInt: sdk.Bool(false), JdbcTreatTimestampNtzAsUtc: sdk.Bool(true), JdbcUseSessionTimezone: sdk.Bool(false), - JSONIndent: sdk.Int(4), + JsonIndent: sdk.Int(4), LockTimeout: sdk.Int(21222), LogLevel: sdk.Pointer(sdk.LogLevelError), MultiStatementCount: sdk.Int(0), @@ -1746,7 +1746,7 @@ func TestInt_Users(t *testing.T) { SimulatedDataSharingConsumer: sdk.String("some_consumer"), StatementQueuedTimeoutInSeconds: sdk.Int(10), StatementTimeoutInSeconds: sdk.Int(10), - StrictJSONOutput: sdk.Bool(true), + StrictJsonOutput: sdk.Bool(true), TimestampDayIsAlways24h: sdk.Bool(true), TimestampInputFormat: sdk.String("YYYY-MM-DD"), TimestampLTZOutputFormat: sdk.String("YYYY-MM-DD HH24:MI:SS"), diff --git a/pkg/sdk/validations.go b/pkg/sdk/validations.go index d8199f2d24..aee936e17a 100644 --- a/pkg/sdk/validations.go +++ b/pkg/sdk/validations.go @@ -89,7 +89,7 @@ func valueSet(value interface{}) bool { return true } -func validateIntInRange(value int, min int, max int) bool { +func validateIntInRangeInclusive(value int, min int, max int) bool { if value < min || value > max { return false } diff --git a/pkg/sdk/validations_test.go b/pkg/sdk/validations_test.go index 36d26c0470..f9661d50aa 100644 --- a/pkg/sdk/validations_test.go +++ b/pkg/sdk/validations_test.go @@ -168,14 +168,14 @@ func TestValueSet(t *testing.T) { }) } -func TestValidateIntInRange(t *testing.T) { +func TestValidateIntInRangeInclusive(t *testing.T) { t.Run("with value in range", func(t *testing.T) { - ok := validateIntInRange(5, 0, 10) + ok := validateIntInRangeInclusive(5, 0, 10) assert.Equal(t, ok, true) }) t.Run("with value out of range", func(t *testing.T) { - ok := validateIntInRange(5, 10, 20) + ok := validateIntInRangeInclusive(5, 10, 20) assert.Equal(t, ok, false) }) } diff --git a/pkg/sdk/warehouses.go b/pkg/sdk/warehouses.go index e9799f74dc..d0970687ee 100644 --- a/pkg/sdk/warehouses.go +++ b/pkg/sdk/warehouses.go @@ -155,7 +155,7 @@ func (opts *CreateWarehouseOptions) validate() error { if valueSet(opts.MinClusterCount) && valueSet(opts.MaxClusterCount) && !validateIntGreaterThanOrEqual(*opts.MaxClusterCount, *opts.MinClusterCount) { errs = append(errs, fmt.Errorf("MinClusterCount must be less than or equal to MaxClusterCount")) } - if valueSet(opts.QueryAccelerationMaxScaleFactor) && !validateIntInRange(*opts.QueryAccelerationMaxScaleFactor, 0, 100) { + if valueSet(opts.QueryAccelerationMaxScaleFactor) && !validateIntInRangeInclusive(*opts.QueryAccelerationMaxScaleFactor, 0, 100) { errs = append(errs, errIntBetween("CreateWarehouseOptions", "QueryAccelerationMaxScaleFactor", 0, 100)) } return errors.Join(errs...) @@ -250,7 +250,7 @@ type WarehouseSet struct { func (v *WarehouseSet) validate() error { // we validate only the case then both are set together, if only MinClusterCount is set, we leave it for Snowflake to validate if v.MinClusterCount != nil && valueSet(v.MaxClusterCount) { - if ok := validateIntInRange(*v.MinClusterCount, 1, *v.MaxClusterCount); !ok { + if ok := validateIntInRangeInclusive(*v.MinClusterCount, 1, *v.MaxClusterCount); !ok { return fmt.Errorf("MinClusterCount must be less than or equal to MaxClusterCount") } } @@ -260,7 +260,7 @@ func (v *WarehouseSet) validate() error { } } if v.QueryAccelerationMaxScaleFactor != nil { - if ok := validateIntInRange(*v.QueryAccelerationMaxScaleFactor, 0, 100); !ok { + if ok := validateIntInRangeInclusive(*v.QueryAccelerationMaxScaleFactor, 0, 100); !ok { return fmt.Errorf("QueryAccelerationMaxScaleFactor must be between 0 and 100") } } diff --git a/templates/resources/procedure_python.md.tmpl b/templates/resources/procedure_python.md.tmpl index 2636c371fa..1b16fbd8a4 100644 --- a/templates/resources/procedure_python.md.tmpl +++ b/templates/resources/procedure_python.md.tmpl @@ -11,6 +11,8 @@ description: |- !> **Caution: Preview Feature** This feature is considered a preview feature in the provider, regardless of the state of the resource in Snowflake. We do not guarantee its stability. It will be reworked and marked as a stable feature in future releases. Breaking changes are expected, even without bumping the major version. To use this feature, add the relevant feature name to `preview_features_enabled field` in the [provider configuration](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs#schema). Please always refer to the [Getting Help](https://github.com/Snowflake-Labs/terraform-provider-snowflake?tab=readme-ov-file#getting-help) section in our Github repo to best determine how to get help for your questions. +!> **Caution: Import limitation** To import the python procedure, snowflake-snowpark-python version must be explicitly set in Snowflake (i.e. `snowflake-snowpark-python==1.14.0`). You can verify it by running `DESCRIBE PROCEDURE ` and checking the `packages`. Check [#3303](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/3303) for reference. + -> **Note** External changes to `is_secure` and `null_input_behavior` are not currently supported. They will be handled in the following versions of the provider which may still affect this resource. -> **Note** `COPY GRANTS` and `OR REPLACE` are not currently supported. diff --git a/v1-preparations/LIST_OF_PREVIEW_FEATURES_FOR_V1.md b/v1-preparations/LIST_OF_PREVIEW_FEATURES_FOR_V1.md index 93164a2c18..d0c39508a4 100644 --- a/v1-preparations/LIST_OF_PREVIEW_FEATURES_FOR_V1.md +++ b/v1-preparations/LIST_OF_PREVIEW_FEATURES_FOR_V1.md @@ -1,6 +1,6 @@ # List of preview resources and data sources that are available in V1 -[Preview features](../ROADMAP.md#preview-resourcesdata sources) for the V1: +[Preview features](../ROADMAP.md#preview-resourcesdatasources) for the V1: * [snowflake_current_account](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/1.0.0/docs/data-sources/current_account) (data source) * [snowflake_account_password_policy_attachment](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/1.0.0/docs/resources/account_password_policy_attachment)