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/index.md b/docs/index.md index 31fc8211d8..bc11401f91 100644 --- a/docs/index.md +++ b/docs/index.md @@ -97,7 +97,7 @@ provider "snowflake" { - `passcode_in_password` (Boolean) False by default. Set to true if the MFA passcode is embedded to the configured password. Can also be sourced from the `SNOWFLAKE_PASSCODE_IN_PASSWORD` environment variable. - `password` (String, Sensitive) Password for user + password auth. Cannot be used with `private_key` and `private_key_passphrase`. Can also be sourced from the `SNOWFLAKE_PASSWORD` environment variable. - `port` (Number) Specifies a custom port value used by the driver for privatelink connections. Can also be sourced from the `SNOWFLAKE_PORT` environment variable. -- `preview_features_enabled` (Set of String) A list of preview features that are handled by the provider. See [preview features list](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/v1-preparations/LIST_OF_PREVIEW_FEATURES_FOR_V1.md). Preview features may have breaking changes in future releases, even without raising the major version. This field can not be set with environmental variables. Valid options are: `snowflake_current_account_datasource` | `snowflake_account_authentication_policy_attachment_resource` | `snowflake_account_password_policy_attachment_resource` | `snowflake_alert_resource` | `snowflake_alerts_datasource` | `snowflake_api_integration_resource` | `snowflake_authentication_policy_resource` | `snowflake_cortex_search_service_resource` | `snowflake_cortex_search_services_datasource` | `snowflake_database_datasource` | `snowflake_database_role_datasource` | `snowflake_dynamic_table_resource` | `snowflake_dynamic_tables_datasource` | `snowflake_external_function_resource` | `snowflake_external_functions_datasource` | `snowflake_external_table_resource` | `snowflake_external_tables_datasource` | `snowflake_external_volume_resource` | `snowflake_failover_group_resource` | `snowflake_failover_groups_datasource` | `snowflake_file_format_resource` | `snowflake_file_formats_datasource` | `snowflake_function_java_resource` | `snowflake_function_javascript_resource` | `snowflake_function_python_resource` | `snowflake_function_scala_resource` | `snowflake_function_sql_resource` | `snowflake_managed_account_resource` | `snowflake_materialized_view_resource` | `snowflake_materialized_views_datasource` | `snowflake_network_policy_attachment_resource` | `snowflake_network_rule_resource` | `snowflake_email_notification_integration_resource` | `snowflake_notification_integration_resource` | `snowflake_object_parameter_resource` | `snowflake_password_policy_resource` | `snowflake_pipe_resource` | `snowflake_pipes_datasource` | `snowflake_current_role_datasource` | `snowflake_sequence_resource` | `snowflake_sequences_datasource` | `snowflake_share_resource` | `snowflake_shares_datasource` | `snowflake_parameters_datasource` | `snowflake_procedure_java_resource` | `snowflake_procedure_javascript_resource` | `snowflake_procedure_python_resource` | `snowflake_procedure_scala_resource` | `snowflake_procedure_sql_resource` | `snowflake_stage_resource` | `snowflake_stages_datasource` | `snowflake_storage_integration_resource` | `snowflake_storage_integrations_datasource` | `snowflake_system_generate_scim_access_token_datasource` | `snowflake_system_get_aws_sns_iam_policy_datasource` | `snowflake_system_get_privatelink_config_datasource` | `snowflake_system_get_snowflake_platform_info_datasource` | `snowflake_table_column_masking_policy_application_resource` | `snowflake_table_constraint_resource` | `snowflake_table_resource` | `snowflake_user_authentication_policy_attachment_resource` | `snowflake_user_public_keys_resource` | `snowflake_user_password_policy_attachment_resource`. +- `preview_features_enabled` (Set of String) A list of preview features that are handled by the provider. See [preview features list](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/v1-preparations/LIST_OF_PREVIEW_FEATURES_FOR_V1.md). Preview features may have breaking changes in future releases, even without raising the major version. This field can not be set with environmental variables. Valid options are: `snowflake_current_account_datasource` | `snowflake_account_authentication_policy_attachment_resource` | `snowflake_account_password_policy_attachment_resource` | `snowflake_alert_resource` | `snowflake_alerts_datasource` | `snowflake_api_integration_resource` | `snowflake_authentication_policy_resource` | `snowflake_cortex_search_service_resource` | `snowflake_cortex_search_services_datasource` | `snowflake_database_datasource` | `snowflake_database_role_datasource` | `snowflake_dynamic_table_resource` | `snowflake_dynamic_tables_datasource` | `snowflake_external_function_resource` | `snowflake_external_functions_datasource` | `snowflake_external_table_resource` | `snowflake_external_tables_datasource` | `snowflake_external_volume_resource` | `snowflake_failover_group_resource` | `snowflake_failover_groups_datasource` | `snowflake_file_format_resource` | `snowflake_file_formats_datasource` | `snowflake_function_java_resource` | `snowflake_function_javascript_resource` | `snowflake_function_python_resource` | `snowflake_function_scala_resource` | `snowflake_function_sql_resource` | `snowflake_functions_datasource` | `snowflake_managed_account_resource` | `snowflake_materialized_view_resource` | `snowflake_materialized_views_datasource` | `snowflake_network_policy_attachment_resource` | `snowflake_network_rule_resource` | `snowflake_email_notification_integration_resource` | `snowflake_notification_integration_resource` | `snowflake_object_parameter_resource` | `snowflake_password_policy_resource` | `snowflake_pipe_resource` | `snowflake_pipes_datasource` | `snowflake_current_role_datasource` | `snowflake_sequence_resource` | `snowflake_sequences_datasource` | `snowflake_share_resource` | `snowflake_shares_datasource` | `snowflake_parameters_datasource` | `snowflake_procedure_java_resource` | `snowflake_procedure_javascript_resource` | `snowflake_procedure_python_resource` | `snowflake_procedure_scala_resource` | `snowflake_procedure_sql_resource` | `snowflake_procedures_datasource` | `snowflake_stage_resource` | `snowflake_stages_datasource` | `snowflake_storage_integration_resource` | `snowflake_storage_integrations_datasource` | `snowflake_system_generate_scim_access_token_datasource` | `snowflake_system_get_aws_sns_iam_policy_datasource` | `snowflake_system_get_privatelink_config_datasource` | `snowflake_system_get_snowflake_platform_info_datasource` | `snowflake_table_column_masking_policy_application_resource` | `snowflake_table_constraint_resource` | `snowflake_table_resource` | `snowflake_tables_datasource` | `snowflake_user_authentication_policy_attachment_resource` | `snowflake_user_public_keys_resource` | `snowflake_user_password_policy_attachment_resource`. - `private_key` (String, Sensitive) Private Key for username+private-key auth. Cannot be used with `password`. Can also be sourced from the `SNOWFLAKE_PRIVATE_KEY` environment variable. - `private_key_passphrase` (String, Sensitive) Supports the encryption ciphers aes-128-cbc, aes-128-gcm, aes-192-cbc, aes-192-gcm, aes-256-cbc, aes-256-gcm, and des-ede3-cbc. Can also be sourced from the `SNOWFLAKE_PRIVATE_KEY_PASSPHRASE` environment variable. - `profile` (String) Sets the profile to read from ~/.snowflake/config file. Can also be sourced from the `SNOWFLAKE_PROFILE` environment variable. 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 = < **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 = < 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/poc/README.md b/pkg/sdk/poc/README.md index eabaf74e55..c7f24fd5f5 100644 --- a/pkg/sdk/poc/README.md +++ b/pkg/sdk/poc/README.md @@ -11,7 +11,9 @@ There is an example file ready for generation [database_role_def.go](example/dat - [database_role_validations_gen.go](example/database_role_validations_gen.go) - options structs validations - [database_role_impl_gen.go](example/database_role_impl_gen.go) - SDK interface implementation - [database_role_gen_test.go](example/database_role_gen_test.go) - unit tests placeholders with guidance comments (at least for now) -- [database_role_gen_integration_test.go](example/database_role_gen_integration_test.go) - integration test placeholder file + +Note: +- for now integration tests files are not generated and they have to be created manually in the `pkg/sdk/testint` directory ### How it works ##### Creating object generation definition @@ -49,10 +51,6 @@ also adding small changes is very challenging, e.g. for new validation rule you one new function, revert to old tests (the one with filled tests), copy new test case (of course we could add that one by hand but if we add one case, or modify more cases this becomes more challenging) - add support for Enums -- generate `ShowID` function with 3 implementation variations (the last one is the rarest one and can be postponed) - - use `Show` function with Like - - use Show without any options and filter with Go for + if - - in some cases we could need more filters -> see alerts.go (but we can implement it later) - handle arrays - handle more validation types - write new `valueSet` function (see validations.go) that will have better defaults or more parameters that will determine @@ -124,15 +122,6 @@ B := QueryStruct("B") ``` - cannot re-generate when client.go is using generated interface - spaces in templates (especially nested validations) -- request mapping fails (`.toOpts()`) when nested object is not optional (pointer) e.g. -```go -type NestedReq struct { -} - -type SomeReq struct { - NestedReq NestedReq // Not a pointer and in toOpts right now we're always do a check if req.NestedReq != nil which is not correct for non pointer type -} -``` ##### Known limitations - automatic array conversion is not recursive, so we're only supporting one level mapping diff --git a/pkg/sdk/poc/generator/operation.go b/pkg/sdk/poc/generator/operation.go index c8d0c7e422..dfc20ca034 100644 --- a/pkg/sdk/poc/generator/operation.go +++ b/pkg/sdk/poc/generator/operation.go @@ -161,12 +161,14 @@ func (i *Interface) ShowOperation(doc string, dbRepresentation *dbStruct, resour return i } -func (i *Interface) ShowByIdOperation() *Interface { +// ShowByIdOperationWithNoFiltering adds a ShowByID operation to the interface without any filtering. Should be used for objects that do not implement any filtering options. +func (i *Interface) ShowByIdOperationWithNoFiltering() *Interface { op := newNoSqlOperation(string(OperationKindShowByID)) i.Operations = append(i.Operations, op) return i } +// ShowByIdOperationWithFiltering adds a ShowByID operation to the interface with filtering. Should be used for objects that implement filtering options e.g. Like or In. func (i *Interface) ShowByIdOperationWithFiltering(filter ShowByIDFilteringKind, filtering ...ShowByIDFilteringKind) *Interface { op := newNoSqlOperation(string(OperationKindShowByID)) op.ObjectInterface = i diff --git a/pkg/sdk/poc/generator/show_by_id_filtering.go b/pkg/sdk/poc/generator/show_by_id_filtering.go index c80ec3aef3..646624b2ed 100644 --- a/pkg/sdk/poc/generator/show_by_id_filtering.go +++ b/pkg/sdk/poc/generator/show_by_id_filtering.go @@ -12,7 +12,6 @@ const ( ShowByIDInFiltering ShowByIDExtendedInFiltering ShowByIDApplicationNameFiltering - ShowByIDNoFiltering ) type idPrefix string @@ -58,10 +57,6 @@ func newShowByIDFiltering(name, kind, args string) ShowByIDFiltering { } } -func newShowByIDNoFiltering() ShowByIDFiltering { - return newShowByIDFiltering("NoFiltering", "", "") -} - func newShowByIDLikeFiltering() ShowByIDFiltering { return newShowByIDFiltering("Like", "Like", "Pattern: String(id.Name())") } @@ -103,8 +98,6 @@ func (s *Operation) withFiltering(filtering ...ShowByIDFilteringKind) *Operation s.ShowByIDFiltering = append(s.ShowByIDFiltering, newShowByIDLikeFiltering()) case ShowByIDApplicationNameFiltering: s.ShowByIDFiltering = append(s.ShowByIDFiltering, newShowByIDApplicationFiltering()) - case ShowByIDNoFiltering: - s.ShowByIDFiltering = []ShowByIDFiltering{newShowByIDNoFiltering()} default: log.Println("No showByID filtering found for kind:", filteringKind) } diff --git a/pkg/sdk/poc/generator/template_executors.go b/pkg/sdk/poc/generator/template_executors.go index 00b4678410..a2fba04cc7 100644 --- a/pkg/sdk/poc/generator/template_executors.go +++ b/pkg/sdk/poc/generator/template_executors.go @@ -92,11 +92,6 @@ func GenerateValidations(writer io.Writer, def *Interface) { printTo(writer, ValidationsTemplate, def) } -func GenerateIntegrationTests(writer io.Writer, def *Interface) { - generatePackageDirective(writer) - printTo(writer, IntegrationTestsTemplate, def) -} - func generatePackageDirective(writer io.Writer) { printTo(writer, PackageTemplate, os.Getenv("GOPACKAGE")) } diff --git a/pkg/sdk/poc/generator/templates.go b/pkg/sdk/poc/generator/templates.go index 8d7d6b52b4..8e0188bcb2 100644 --- a/pkg/sdk/poc/generator/templates.go +++ b/pkg/sdk/poc/generator/templates.go @@ -32,10 +32,6 @@ var ( dtoStructsTemplateContent string DtoDeclTemplate, _ = template.New("dtoTemplate").Parse(dtoStructsTemplateContent) - //go:embed templates/integration_tests.tmpl - integrationTestTemplateContent string - IntegrationTestsTemplate, _ = template.New("integrationTestsTemplate").Parse(integrationTestTemplateContent) - //go:embed templates/implementation.tmpl implementationTemplateContent string ImplementationTemplate *template.Template diff --git a/pkg/sdk/poc/generator/templates/integration_tests.tmpl b/pkg/sdk/poc/generator/templates/integration_tests.tmpl deleted file mode 100644 index f814ba6f31..0000000000 --- a/pkg/sdk/poc/generator/templates/integration_tests.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -{{- /*gotype: github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/poc/generator.Interface*/ -}} - -import "testing" - -func TestInt_{{ .Name }}(t *testing.T) { -// TODO: prepare common resources - -{{ range .Operations }} - t.Run("{{ .Name }}", func(t *testing.T) { - // TODO: fill me - }) -{{ end -}} -} diff --git a/pkg/sdk/poc/generator/templates/sub_templates/implementation_functions.tmpl b/pkg/sdk/poc/generator/templates/sub_templates/implementation_functions.tmpl index 60b0cc7e0d..7c89cefa99 100644 --- a/pkg/sdk/poc/generator/templates/sub_templates/implementation_functions.tmpl +++ b/pkg/sdk/poc/generator/templates/sub_templates/implementation_functions.tmpl @@ -16,10 +16,8 @@ {{ else if eq .Name "ShowByID" }} func (v *{{ $impl }}) ShowByID(ctx context.Context, id {{ .ObjectInterface.IdentifierKind }}) (*{{ .ObjectInterface.NameSingular }}, error) { request := NewShow{{ .ObjectInterface.NameSingular }}Request() - {{- range .ShowByIDFiltering }} - {{- if not (eq .Name "NoFiltering") -}}. - {{ .WithFiltering }} - {{- end }} + {{- range .ShowByIDFiltering }}. + {{ .WithFiltering }} {{- end }} {{ $impl }}, err := v.Show(ctx, request) if err != nil { diff --git a/pkg/sdk/poc/main.go b/pkg/sdk/poc/main.go index d7fd8c094a..fb7596ec9b 100644 --- a/pkg/sdk/poc/main.go +++ b/pkg/sdk/poc/main.go @@ -57,6 +57,7 @@ func main() { // runAllTemplatesToStdOut(definition) runAllTemplatesAndSave(definition, file) + fmt.Println("Integration tests should be added manually to the pkg/sdk/testint/ directory") } func getDefinition(file string) *generator.Interface { @@ -94,7 +95,6 @@ func runAllTemplatesToStdOut(definition *generator.Interface) { generator.GenerateImplementation(writer, definition) generator.GenerateUnitTests(writer, definition) generator.GenerateValidations(writer, definition) - generator.GenerateIntegrationTests(writer, definition) } func runAllTemplatesAndSave(definition *generator.Interface, file string) { @@ -104,7 +104,6 @@ func runAllTemplatesAndSave(definition *generator.Interface, file string) { runTemplateAndSave(definition, generator.GenerateImplementation, filenameFor(fileWithoutSuffix, "_impl")) runTemplateAndSave(definition, generator.GenerateUnitTests, filename(fileWithoutSuffix, "_gen", "_test.go")) runTemplateAndSave(definition, generator.GenerateValidations, filenameFor(fileWithoutSuffix, "_validations")) - runTemplateAndSave(definition, generator.GenerateIntegrationTests, filename(fileWithoutSuffix, "_gen_integration", "_test.go")) } func runTemplateAndSave(def *generator.Interface, genFunc func(io.Writer, *generator.Interface), fileName string) { diff --git a/pkg/sdk/procedures_def.go b/pkg/sdk/procedures_def.go index 636da06187..1779da568b 100644 --- a/pkg/sdk/procedures_def.go +++ b/pkg/sdk/procedures_def.go @@ -355,7 +355,10 @@ var ProceduresDef = g.NewInterface( SQL("PROCEDURES"). OptionalLike(). OptionalExtendedIn(), -).ShowByIdOperation().DescribeOperation( +).ShowByIdOperationWithFiltering( + g.ShowByIDInFiltering, + g.ShowByIDLikeFiltering, +).DescribeOperation( g.DescriptionMappingKindSlice, "https://docs.snowflake.com/en/sql-reference/sql/desc-procedure", g.DbStruct("procedureDetailRow"). diff --git a/pkg/sdk/procedures_impl_gen.go b/pkg/sdk/procedures_impl_gen.go index 5a7e1ce84e..9772688a3d 100644 --- a/pkg/sdk/procedures_impl_gen.go +++ b/pkg/sdk/procedures_impl_gen.go @@ -60,7 +60,10 @@ func (v *procedures) Show(ctx context.Context, request *ShowProcedureRequest) ([ } func (v *procedures) ShowByID(ctx context.Context, id SchemaObjectIdentifierWithArguments) (*Procedure, error) { - procedures, err := v.Show(ctx, NewShowProcedureRequest().WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}).WithLike(Like{String(id.Name())})) + request := NewShowProcedureRequest(). + WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}). + WithLike(Like{Pattern: String(id.Name())}) + procedures, err := v.Show(ctx, request) if err != nil { return nil, err } diff --git a/pkg/sdk/row_access_policies_def.go b/pkg/sdk/row_access_policies_def.go index 02d42c0dbb..a6f1fd5453 100644 --- a/pkg/sdk/row_access_policies_def.go +++ b/pkg/sdk/row_access_policies_def.go @@ -90,7 +90,10 @@ var RowAccessPoliciesDef = g.NewInterface( OptionalExtendedIn(). OptionalLimitFrom(), ). - ShowByIdOperation(). + ShowByIdOperationWithFiltering( + g.ShowByIDExtendedInFiltering, + g.ShowByIDLikeFiltering, + ). DescribeOperation( g.DescriptionMappingKindSingleValue, "https://docs.snowflake.com/en/sql-reference/sql/desc-row-access-policy", diff --git a/pkg/sdk/row_access_policies_dto_builders_gen.go b/pkg/sdk/row_access_policies_dto_builders_gen.go index ffdc0454dd..ef23517847 100644 --- a/pkg/sdk/row_access_policies_dto_builders_gen.go +++ b/pkg/sdk/row_access_policies_dto_builders_gen.go @@ -100,13 +100,13 @@ func NewShowRowAccessPolicyRequest() *ShowRowAccessPolicyRequest { return &ShowRowAccessPolicyRequest{} } -func (s *ShowRowAccessPolicyRequest) WithLike(Like *Like) *ShowRowAccessPolicyRequest { - s.Like = Like +func (s *ShowRowAccessPolicyRequest) WithLike(Like Like) *ShowRowAccessPolicyRequest { + s.Like = &Like return s } -func (s *ShowRowAccessPolicyRequest) WithIn(In *ExtendedIn) *ShowRowAccessPolicyRequest { - s.In = In +func (s *ShowRowAccessPolicyRequest) WithIn(In ExtendedIn) *ShowRowAccessPolicyRequest { + s.In = &In return s } diff --git a/pkg/sdk/row_access_policies_impl_gen.go b/pkg/sdk/row_access_policies_impl_gen.go index f6f0f1e905..03dbab8e7d 100644 --- a/pkg/sdk/row_access_policies_impl_gen.go +++ b/pkg/sdk/row_access_policies_impl_gen.go @@ -39,7 +39,9 @@ func (v *rowAccessPolicies) Show(ctx context.Context, request *ShowRowAccessPoli } func (v *rowAccessPolicies) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*RowAccessPolicy, error) { - request := NewShowRowAccessPolicyRequest().WithIn(&ExtendedIn{In: In{Schema: id.SchemaId()}}).WithLike(&Like{String(id.Name())}) + request := NewShowRowAccessPolicyRequest(). + WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}). + WithLike(Like{Pattern: String(id.Name())}) rowAccessPolicies, err := v.Show(ctx, request) if err != nil { return nil, err diff --git a/pkg/sdk/security_integrations_def.go b/pkg/sdk/security_integrations_def.go index 1fb48d58cf..e027084493 100644 --- a/pkg/sdk/security_integrations_def.go +++ b/pkg/sdk/security_integrations_def.go @@ -976,4 +976,6 @@ var SecurityIntegrationsDef = g.NewInterface( SQL("SECURITY INTEGRATIONS"). OptionalLike(), ). - ShowByIdOperation() + ShowByIdOperationWithFiltering( + g.ShowByIDLikeFiltering, + ) diff --git a/pkg/sdk/security_integrations_impl_gen.go b/pkg/sdk/security_integrations_impl_gen.go index d430bbc2d9..3c1bf90a29 100644 --- a/pkg/sdk/security_integrations_impl_gen.go +++ b/pkg/sdk/security_integrations_impl_gen.go @@ -119,9 +119,9 @@ func (v *securityIntegrations) Show(ctx context.Context, request *ShowSecurityIn } func (v *securityIntegrations) ShowByID(ctx context.Context, id AccountObjectIdentifier) (*SecurityIntegration, error) { - securityIntegrations, err := v.Show(ctx, NewShowSecurityIntegrationRequest().WithLike(Like{ - Pattern: String(id.Name()), - })) + request := NewShowSecurityIntegrationRequest(). + WithLike(Like{Pattern: String(id.Name())}) + securityIntegrations, err := v.Show(ctx, request) if err != nil { return nil, err } diff --git a/pkg/sdk/sequences_def.go b/pkg/sdk/sequences_def.go index c73ea4d506..95bcbeb9e3 100644 --- a/pkg/sdk/sequences_def.go +++ b/pkg/sdk/sequences_def.go @@ -78,7 +78,10 @@ var SequencesDef = g.NewInterface( SQL("SEQUENCES"). OptionalLike(). OptionalIn(), -).ShowByIdOperation().DescribeOperation( +).ShowByIdOperationWithFiltering( + g.ShowByIDInFiltering, + g.ShowByIDLikeFiltering, +).DescribeOperation( g.DescriptionMappingKindSingleValue, "https://docs.snowflake.com/en/sql-reference/sql/desc-sequence", g.DbStruct("sequenceDetailRow"). diff --git a/pkg/sdk/sequences_dto_builders_gen.go b/pkg/sdk/sequences_dto_builders_gen.go index 95b0355f95..1967527f5c 100644 --- a/pkg/sdk/sequences_dto_builders_gen.go +++ b/pkg/sdk/sequences_dto_builders_gen.go @@ -2,8 +2,6 @@ package sdk -import () - func NewCreateSequenceRequest( name SchemaObjectIdentifier, ) *CreateSequenceRequest { @@ -93,13 +91,13 @@ func NewShowSequenceRequest() *ShowSequenceRequest { return &ShowSequenceRequest{} } -func (s *ShowSequenceRequest) WithLike(Like *Like) *ShowSequenceRequest { - s.Like = Like +func (s *ShowSequenceRequest) WithLike(Like Like) *ShowSequenceRequest { + s.Like = &Like return s } -func (s *ShowSequenceRequest) WithIn(In *In) *ShowSequenceRequest { - s.In = In +func (s *ShowSequenceRequest) WithIn(In In) *ShowSequenceRequest { + s.In = &In return s } diff --git a/pkg/sdk/sequences_impl_gen.go b/pkg/sdk/sequences_impl_gen.go index 202f61b605..e2a4a4a6dc 100644 --- a/pkg/sdk/sequences_impl_gen.go +++ b/pkg/sdk/sequences_impl_gen.go @@ -33,7 +33,9 @@ func (v *sequences) Show(ctx context.Context, request *ShowSequenceRequest) ([]S } func (v *sequences) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*Sequence, error) { - request := NewShowSequenceRequest().WithIn(&In{Schema: id.SchemaId()}).WithLike(&Like{String(id.Name())}) + request := NewShowSequenceRequest(). + WithIn(In{Schema: id.SchemaId()}). + WithLike(Like{Pattern: String(id.Name())}) sequences, err := v.Show(ctx, request) if err != nil { return nil, err diff --git a/pkg/sdk/session_policies_def.go b/pkg/sdk/session_policies_def.go index 3b172f5562..f892ffd038 100644 --- a/pkg/sdk/session_policies_def.go +++ b/pkg/sdk/session_policies_def.go @@ -89,9 +89,7 @@ var SessionPoliciesDef = g.NewInterface( Show(). SQL("SESSION POLICIES"), ). - ShowByIdOperationWithFiltering( - g.ShowByIDNoFiltering, - ). + ShowByIdOperationWithNoFiltering(). DescribeOperation( g.DescriptionMappingKindSingleValue, "https://docs.snowflake.com/en/sql-reference/sql/desc-session-policy", diff --git a/pkg/sdk/stages_def.go b/pkg/sdk/stages_def.go index a71688d92e..abb686e161 100644 --- a/pkg/sdk/stages_def.go +++ b/pkg/sdk/stages_def.go @@ -398,4 +398,7 @@ var StagesDef = g.NewInterface( OptionalLike(). OptionalIn(), ). - ShowByIdOperation() + ShowByIdOperationWithFiltering( + g.ShowByIDLikeFiltering, + g.ShowByIDInFiltering, + ) diff --git a/pkg/sdk/stages_dto_builders_gen.go b/pkg/sdk/stages_dto_builders_gen.go index 9aec793e27..31fb4d67a3 100644 --- a/pkg/sdk/stages_dto_builders_gen.go +++ b/pkg/sdk/stages_dto_builders_gen.go @@ -826,12 +826,12 @@ func NewShowStageRequest() *ShowStageRequest { return &ShowStageRequest{} } -func (s *ShowStageRequest) WithLike(Like *Like) *ShowStageRequest { - s.Like = Like +func (s *ShowStageRequest) WithLike(Like Like) *ShowStageRequest { + s.Like = &Like return s } -func (s *ShowStageRequest) WithIn(In *In) *ShowStageRequest { - s.In = In +func (s *ShowStageRequest) WithIn(In In) *ShowStageRequest { + s.In = &In return s } diff --git a/pkg/sdk/stages_impl_gen.go b/pkg/sdk/stages_impl_gen.go index 9797678aa5..661173144f 100644 --- a/pkg/sdk/stages_impl_gen.go +++ b/pkg/sdk/stages_impl_gen.go @@ -94,13 +94,10 @@ func (v *stages) Show(ctx context.Context, request *ShowStageRequest) ([]Stage, } func (v *stages) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*Stage, error) { - stages, err := v.Show(ctx, NewShowStageRequest(). - WithLike(&Like{ - Pattern: String(id.Name()), - }). - WithIn(&In{ - Schema: id.SchemaId(), - })) + request := NewShowStageRequest(). + WithLike(Like{Pattern: String(id.Name())}). + WithIn(In{Schema: id.SchemaId()}) + stages, err := v.Show(ctx, request) if err != nil { return nil, err } diff --git a/pkg/sdk/storage_integration_def.go b/pkg/sdk/storage_integration_def.go index 04e24c37da..3e89c8b584 100644 --- a/pkg/sdk/storage_integration_def.go +++ b/pkg/sdk/storage_integration_def.go @@ -151,7 +151,9 @@ var StorageIntegrationDef = g.NewInterface( SQL("STORAGE INTEGRATIONS"). OptionalLike(), ). - ShowByIdOperation(). + ShowByIdOperationWithFiltering( + g.ShowByIDLikeFiltering, + ). DescribeOperation( g.DescriptionMappingKindSlice, "https://docs.snowflake.com/en/sql-reference/sql/desc-integration", diff --git a/pkg/sdk/storage_integration_impl_gen.go b/pkg/sdk/storage_integration_impl_gen.go index 9ac54949d8..47aa686b01 100644 --- a/pkg/sdk/storage_integration_impl_gen.go +++ b/pkg/sdk/storage_integration_impl_gen.go @@ -38,9 +38,9 @@ func (v *storageIntegrations) Show(ctx context.Context, request *ShowStorageInte } func (v *storageIntegrations) ShowByID(ctx context.Context, id AccountObjectIdentifier) (*StorageIntegration, error) { - storageIntegrations, err := v.Show(ctx, NewShowStorageIntegrationRequest().WithLike(Like{ - Pattern: String(id.Name()), - })) + request := NewShowStorageIntegrationRequest(). + WithLike(Like{Pattern: String(id.Name())}) + storageIntegrations, err := v.Show(ctx, request) if err != nil { return nil, err } diff --git a/pkg/sdk/streams_def.go b/pkg/sdk/streams_def.go index a67098574f..21395f2b2b 100644 --- a/pkg/sdk/streams_def.go +++ b/pkg/sdk/streams_def.go @@ -233,7 +233,10 @@ var ( OptionalStartsWith(). OptionalLimit(), ). - ShowByIdOperation(). + ShowByIdOperationWithFiltering( + g.ShowByIDExtendedInFiltering, + g.ShowByIDLikeFiltering, + ). DescribeOperation( g.DescriptionMappingKindSingleValue, "https://docs.snowflake.com/en/sql-reference/sql/desc-stream", diff --git a/pkg/sdk/streams_impl_gen.go b/pkg/sdk/streams_impl_gen.go index 6612925b60..969ea99b51 100644 --- a/pkg/sdk/streams_impl_gen.go +++ b/pkg/sdk/streams_impl_gen.go @@ -59,13 +59,10 @@ func (v *streams) Show(ctx context.Context, request *ShowStreamRequest) ([]Strea } func (v *streams) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*Stream, error) { - streams, err := v.Show(ctx, NewShowStreamRequest(). - WithIn(ExtendedIn{ - In: In{ - Schema: id.SchemaId(), - }, - }). - WithLike(Like{Pattern: String(id.Name())})) + request := NewShowStreamRequest(). + WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}). + WithLike(Like{Pattern: String(id.Name())}) + streams, err := v.Show(ctx, request) if err != nil { return nil, err } 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_def.go b/pkg/sdk/tasks_def.go index 83ff671492..13fdaa89fc 100644 --- a/pkg/sdk/tasks_def.go +++ b/pkg/sdk/tasks_def.go @@ -292,7 +292,10 @@ var TasksDef = g.NewInterface( OptionalSQL("ROOT ONLY"). OptionalLimit(), ). - ShowByIdOperation(). + ShowByIdOperationWithFiltering( + g.ShowByIDExtendedInFiltering, + g.ShowByIDLikeFiltering, + ). DescribeOperation( g.DescriptionMappingKindSingleValue, "https://docs.snowflake.com/en/sql-reference/sql/desc-task", 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/tasks_impl_gen.go b/pkg/sdk/tasks_impl_gen.go index 5f7bd10a82..96ec539770 100644 --- a/pkg/sdk/tasks_impl_gen.go +++ b/pkg/sdk/tasks_impl_gen.go @@ -54,13 +54,10 @@ func (v *tasks) Show(ctx context.Context, request *ShowTaskRequest) ([]Task, err } func (v *tasks) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*Task, error) { - tasks, err := v.Show(ctx, NewShowTaskRequest().WithIn(ExtendedIn{ - In: In{ - Schema: id.SchemaId(), - }, - }).WithLike(Like{ - Pattern: String(id.Name()), - })) + request := NewShowTaskRequest(). + WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}). + WithLike(Like{Pattern: String(id.Name())}) + tasks, err := v.Show(ctx, request) if err != nil { return nil, err } 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/api_integrations_gen_integration_test.go b/pkg/sdk/testint/api_integrations_gen_integration_test.go index b4c04c6e64..7f816d6b4d 100644 --- a/pkg/sdk/testint/api_integrations_gen_integration_test.go +++ b/pkg/sdk/testint/api_integrations_gen_integration_test.go @@ -387,7 +387,7 @@ func TestInt_ApiIntegrations(t *testing.T) { integrationAzure := createAzureApiIntegration(t) showRequest := sdk.NewShowApiIntegrationRequest(). - WithLike(&sdk.Like{Pattern: &integrationAws.Name}) + WithLike(sdk.Like{Pattern: &integrationAws.Name}) returnedIntegrations, err := client.ApiIntegrations.Show(ctx, showRequest) require.NoError(t, err) diff --git a/pkg/sdk/testint/application_packages_integration_test.go b/pkg/sdk/testint/application_packages_integration_test.go index a9e5e5b2fd..dd0d768acc 100644 --- a/pkg/sdk/testint/application_packages_integration_test.go +++ b/pkg/sdk/testint/application_packages_integration_test.go @@ -123,7 +123,7 @@ func TestInt_ApplicationPackages(t *testing.T) { t.Run("show application package for SQL: with like", func(t *testing.T) { e := createApplicationPackageHandle(t) - packages, err := client.ApplicationPackages.Show(ctx, sdk.NewShowApplicationPackageRequest().WithLike(&sdk.Like{Pattern: &e.Name})) + packages, err := client.ApplicationPackages.Show(ctx, sdk.NewShowApplicationPackageRequest().WithLike(sdk.Like{Pattern: &e.Name})) require.NoError(t, err) require.Equal(t, 1, len(packages)) require.Equal(t, *e, packages[0]) diff --git a/pkg/sdk/testint/applications_integration_test.go b/pkg/sdk/testint/applications_integration_test.go index 4332983a97..280a119c00 100644 --- a/pkg/sdk/testint/applications_integration_test.go +++ b/pkg/sdk/testint/applications_integration_test.go @@ -182,7 +182,7 @@ func TestInt_Applications(t *testing.T) { t.Run("show application: with like", func(t *testing.T) { version, patch := "V001", 0 _, e, _ := createApplicationHandle(t, version, patch, false, true, false) - packages, err := client.Applications.Show(ctx, sdk.NewShowApplicationRequest().WithLike(&sdk.Like{Pattern: &e.Name})) + packages, err := client.Applications.Show(ctx, sdk.NewShowApplicationRequest().WithLike(sdk.Like{Pattern: &e.Name})) require.NoError(t, err) require.Equal(t, 1, len(packages)) require.Equal(t, *e, packages[0]) diff --git a/pkg/sdk/testint/event_tables_integration_test.go b/pkg/sdk/testint/event_tables_integration_test.go index 434e0e60c0..b6a3cef727 100644 --- a/pkg/sdk/testint/event_tables_integration_test.go +++ b/pkg/sdk/testint/event_tables_integration_test.go @@ -84,7 +84,7 @@ func TestInt_EventTables(t *testing.T) { et1 := createEventTableHandle(t) et2 := createEventTableHandle(t) - tables, err := client.EventTables.Show(ctx, sdk.NewShowEventTableRequest().WithLike(&sdk.Like{Pattern: &et1.Name})) + tables, err := client.EventTables.Show(ctx, sdk.NewShowEventTableRequest().WithLike(sdk.Like{Pattern: &et1.Name})) require.NoError(t, err) assert.Equal(t, 1, len(tables)) assert.Contains(t, tables, *et1) @@ -98,7 +98,7 @@ func TestInt_EventTables(t *testing.T) { }) t.Run("show event table: no matches", func(t *testing.T) { - tables, err := client.EventTables.Show(ctx, sdk.NewShowEventTableRequest().WithLike(&sdk.Like{Pattern: sdk.String("non-existent")})) + tables, err := client.EventTables.Show(ctx, sdk.NewShowEventTableRequest().WithLike(sdk.Like{Pattern: sdk.String("non-existent")})) require.NoError(t, err) assert.Equal(t, 0, len(tables)) }) diff --git a/pkg/sdk/testint/managed_accounts_gen_integration_test.go b/pkg/sdk/testint/managed_accounts_gen_integration_test.go index 717db30db0..b76ce8956c 100644 --- a/pkg/sdk/testint/managed_accounts_gen_integration_test.go +++ b/pkg/sdk/testint/managed_accounts_gen_integration_test.go @@ -125,7 +125,7 @@ func TestInt_ManagedAccounts(t *testing.T) { managedAccount2 := createManagedAccount(t) showRequest := sdk.NewShowManagedAccountRequest(). - WithLike(&sdk.Like{Pattern: &managedAccount1.Name}) + WithLike(sdk.Like{Pattern: &managedAccount1.Name}) returnedManagedAccounts, err := client.ManagedAccounts.Show(ctx, showRequest) require.NoError(t, err) diff --git a/pkg/sdk/testint/materialized_views_gen_integration_test.go b/pkg/sdk/testint/materialized_views_gen_integration_test.go index 6cad7bcb93..f4e74bdb4a 100644 --- a/pkg/sdk/testint/materialized_views_gen_integration_test.go +++ b/pkg/sdk/testint/materialized_views_gen_integration_test.go @@ -335,7 +335,7 @@ func TestInt_MaterializedViews(t *testing.T) { t.Run("show materialized view: no existing view", func(t *testing.T) { showRequest := sdk.NewShowMaterializedViewRequest(). - WithIn(&sdk.In{Schema: testClientHelper().Ids.SchemaId()}) + WithIn(sdk.In{Schema: testClientHelper().Ids.SchemaId()}) returnedViews, err := client.MaterializedViews.Show(ctx, showRequest) require.NoError(t, err) @@ -344,7 +344,7 @@ func TestInt_MaterializedViews(t *testing.T) { t.Run("show materialized view: schema not existing", func(t *testing.T) { showRequest := sdk.NewShowMaterializedViewRequest(). - WithIn(&sdk.In{Schema: NonExistingDatabaseObjectIdentifier}) + WithIn(sdk.In{Schema: NonExistingDatabaseObjectIdentifier}) _, err := client.MaterializedViews.Show(ctx, showRequest) require.Error(t, err) }) @@ -354,8 +354,8 @@ func TestInt_MaterializedViews(t *testing.T) { view2 := createMaterializedView(t) showRequest := sdk.NewShowMaterializedViewRequest(). - WithLike(&sdk.Like{Pattern: &view1.Name}). - WithIn(&sdk.In{Schema: testClientHelper().Ids.SchemaId()}) + WithLike(sdk.Like{Pattern: &view1.Name}). + WithIn(sdk.In{Schema: testClientHelper().Ids.SchemaId()}) returnedViews, err := client.MaterializedViews.Show(ctx, showRequest) require.NoError(t, err) diff --git a/pkg/sdk/testint/network_rule_gen_integration_test.go b/pkg/sdk/testint/network_rule_gen_integration_test.go index 705b29824b..91122f3b05 100644 --- a/pkg/sdk/testint/network_rule_gen_integration_test.go +++ b/pkg/sdk/testint/network_rule_gen_integration_test.go @@ -92,9 +92,9 @@ func TestInt_NetworkRules(t *testing.T) { require.NoError(t, err) }) - networkRules, err := client.NetworkRules.Show(ctx, sdk.NewShowNetworkRuleRequest().WithIn(&sdk.In{ + networkRules, err := client.NetworkRules.Show(ctx, sdk.NewShowNetworkRuleRequest().WithIn(sdk.In{ Schema: id.SchemaId(), - }).WithLike(&sdk.Like{ + }).WithLike(sdk.Like{ Pattern: sdk.String(id.Name()), })) require.NoError(t, err) diff --git a/pkg/sdk/testint/notification_integrations_gen_integration_test.go b/pkg/sdk/testint/notification_integrations_gen_integration_test.go index e813680226..5f3c4ab354 100644 --- a/pkg/sdk/testint/notification_integrations_gen_integration_test.go +++ b/pkg/sdk/testint/notification_integrations_gen_integration_test.go @@ -401,7 +401,7 @@ func TestInt_NotificationIntegrations(t *testing.T) { notificationAutoAzure := createNotificationIntegrationAutoAzure(t) showRequest := sdk.NewShowNotificationIntegrationRequest(). - WithLike(&sdk.Like{Pattern: ¬ificationAutoGoogle.Name}) + WithLike(sdk.Like{Pattern: ¬ificationAutoGoogle.Name}) returnedIntegrations, err := client.NotificationIntegrations.Show(ctx, showRequest) require.NoError(t, err) 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/row_access_policies_gen_integration_test.go b/pkg/sdk/testint/row_access_policies_gen_integration_test.go index 2833210fe8..cbcea2f05e 100644 --- a/pkg/sdk/testint/row_access_policies_gen_integration_test.go +++ b/pkg/sdk/testint/row_access_policies_gen_integration_test.go @@ -190,8 +190,8 @@ func TestInt_RowAccessPolicies(t *testing.T) { t.Cleanup(cleanup2) showRequest := sdk.NewShowRowAccessPolicyRequest(). - WithLike(&sdk.Like{Pattern: &rowAccessPolicy1.Name}). - WithIn(&sdk.ExtendedIn{In: sdk.In{Schema: testClientHelper().Ids.SchemaId()}}). + WithLike(sdk.Like{Pattern: &rowAccessPolicy1.Name}). + WithIn(sdk.ExtendedIn{In: sdk.In{Schema: testClientHelper().Ids.SchemaId()}}). WithLimit(&sdk.LimitFrom{Rows: sdk.Int(5)}) returnedRowAccessPolicies, err := client.RowAccessPolicies.Show(ctx, showRequest) diff --git a/pkg/sdk/testint/sequences_integration_test.go b/pkg/sdk/testint/sequences_integration_test.go index 1a8cb538f2..c268cfa85e 100644 --- a/pkg/sdk/testint/sequences_integration_test.go +++ b/pkg/sdk/testint/sequences_integration_test.go @@ -92,7 +92,7 @@ func TestInt_Sequences(t *testing.T) { e1 := createSequenceHandle(t) e2 := createSequenceHandle(t) - sequences, err := client.Sequences.Show(ctx, sdk.NewShowSequenceRequest().WithLike(&sdk.Like{Pattern: &e1.Name})) + sequences, err := client.Sequences.Show(ctx, sdk.NewShowSequenceRequest().WithLike(sdk.Like{Pattern: &e1.Name})) require.NoError(t, err) require.Equal(t, 1, len(sequences)) require.Contains(t, sequences, *e1) @@ -100,7 +100,7 @@ func TestInt_Sequences(t *testing.T) { }) t.Run("show sequence: no matches", func(t *testing.T) { - sequences, err := client.Sequences.Show(ctx, sdk.NewShowSequenceRequest().WithLike(&sdk.Like{Pattern: sdk.String("non-existent")})) + sequences, err := client.Sequences.Show(ctx, sdk.NewShowSequenceRequest().WithLike(sdk.Like{Pattern: sdk.String("non-existent")})) require.NoError(t, err) require.Equal(t, 0, len(sequences)) }) 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/views_def.go b/pkg/sdk/views_def.go index e981a19c70..0346ace03b 100644 --- a/pkg/sdk/views_def.go +++ b/pkg/sdk/views_def.go @@ -336,7 +336,10 @@ var ViewsDef = g.NewInterface( OptionalStartsWith(). OptionalLimit(), ). - ShowByIdOperation(). + ShowByIdOperationWithFiltering( + g.ShowByIDExtendedInFiltering, + g.ShowByIDLikeFiltering, + ). DescribeOperation( g.DescriptionMappingKindSlice, "https://docs.snowflake.com/en/sql-reference/sql/desc-view", diff --git a/pkg/sdk/views_impl_gen.go b/pkg/sdk/views_impl_gen.go index a9a2783fb4..1bf940b4a9 100644 --- a/pkg/sdk/views_impl_gen.go +++ b/pkg/sdk/views_impl_gen.go @@ -40,7 +40,9 @@ func (v *views) Show(ctx context.Context, request *ShowViewRequest) ([]View, err } func (v *views) ShowByID(ctx context.Context, id SchemaObjectIdentifier) (*View, error) { - request := NewShowViewRequest().WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}).WithLike(Like{String(id.Name())}) + request := NewShowViewRequest(). + WithIn(ExtendedIn{In: In{Schema: id.SchemaId()}}). + WithLike(Like{Pattern: String(id.Name())}) views, err := v.Show(ctx, request) if err != nil { return nil, err 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)