From 136fdd336257136a4078e7fa1950a6da68d5479e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Cie=C5=9Blak?= Date: Thu, 22 Aug 2024 12:51:33 +0200 Subject: [PATCH] wip --- .../identifiers_rework_design_decisions.md | 21 ++++++++++---- ...tion_for_custom_clients_acceptance_test.go | 16 +++++------ .../scim_integration_acceptance_test.go | 10 +++---- pkg/resources/table_constraint.go | 2 +- pkg/sdk/failover_groups.go | 2 +- pkg/sdk/identifier_helpers.go | 28 ------------------- pkg/sdk/identifier_parsers.go | 1 - pkg/sdk/policy_references_test.go | 2 +- pkg/sdk/tag_association_validations.go | 2 +- ...cortex_search_services_integration_test.go | 4 +-- .../testint/streamlits_integration_test.go | 2 +- .../testint/streams_gen_integration_test.go | 8 +++--- pkg/sdk/testint/tables_integration_test.go | 2 +- pkg/sdk/testint/views_gen_integration_test.go | 2 +- 14 files changed, 42 insertions(+), 60 deletions(-) diff --git a/docs/technical-documentation/identifiers_rework_design_decisions.md b/docs/technical-documentation/identifiers_rework_design_decisions.md index af655f7fc7..37d52bc605 100644 --- a/docs/technical-documentation/identifiers_rework_design_decisions.md +++ b/docs/technical-documentation/identifiers_rework_design_decisions.md @@ -8,6 +8,7 @@ But before we dive into results and design decisions, here’s the list of reaso - Inconsistencies in quotes causing differences in Terraform plans. - The inconvenience of specifying fully qualified names in certain resource fields (e.g. object name in privilege-granting resources). - Mixed usage of account identifier formats across resources. + Now, knowing the issues we wanted to solve, we would like to present the changes and design decisions we made. ## Topics @@ -45,12 +46,22 @@ This will be a small shift in the identifier representation for resources. The g - If a resource can only be described with the Snowflake identifier, the fully qualified name will be put into the resource identifier. Previously, it was almost the same, except it was separated by pipes, and it was not a valid identifier. - If a resource cannot be described only by a single Snowflake identifier, then the resource identifier will be a pipe-separated text of all parts needed to identify a given resource ([example](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/grant_privileges_to_account_role#import)). Mind that this approach is not compliant with identifiers containing pipes, but this approach is a middle ground between an easy-to-specify separator and a character that shouldn’t be that common in the identifier (it was previously used for all identifiers). -Known limitations and identifier recommendations +### Known limitations and identifier recommendations The main limitations around identifiers are strictly connected to what characters are used. Here’s a list of recommendations on which characters should be generally avoided when specifying identifiers: -Avoid dots ‘.’ inside identifiers. It’s the main separator between identifier parts and although we are handling dots inside identifiers, there may be cases where it’s impossible to parse the identifier correctly. -Avoid pipes ‘|’ inside identifiers. It’s the separator for our more complex resource identifiers that could make our parser split the resource identifier into the wrong parts. -Avoid parentheses ‘(’ and ‘)’ when specifying identifiers for functions, procedures, external functions. Parentheses as part of their identifiers could potentially make our parser split the identifier into wrong parts causing issues. -As a general recommendation, please lean toward simple names without any special characters, and if word separation is needed, use underscores. This also applies to other “identifiers” like column names in tables or argument names in functions. If you are currently using complex identifiers, we recommend considering migration to simpler identifiers for a more straightforward and less error-prone experience. +- Avoid dots ‘.’ inside identifiers. It’s the main separator between identifier parts and although we are handling dots inside identifiers, there may be cases where it’s impossible to parse the identifier correctly. +- Avoid pipes ‘|’ inside identifiers. It’s the separator for our more complex resource identifiers that could make our parser split the resource identifier into the wrong parts. +- Avoid parentheses ‘(’ and ‘)’ when specifying identifiers for functions, procedures, external functions. Parentheses as part of their identifiers could potentially make our parser split the identifier into wrong parts causing issues. + +As a general recommendation, please lean toward simple names without any special characters, and if word separation is needed, use underscores. +This also applies to other “identifiers” like column names in tables or argument names in functions. +If you are currently using complex identifiers, we recommend considering migration to simpler identifiers for a more straightforward and less error-prone experience. +Also, we want to make it clear that every field specifying identifier (or its part, e.g. `name`, `database`, `schema`) are always case-sensitive. By specifying +identifiers with lowercase characters in Terraform, you also have to refer to them with lowercase names in quotes in Snowflake. +For example, by specifying an account role with `name = "test"` to check privileges granted to the role in Snowflake, you have to call: +```sql +show grants to role "test"; +show grants to role test; -- this won't work, because unquoted identifiers are converted to uppercase according to https://docs.snowflake.com/en/sql-reference/identifiers-syntax#label-identifier-casing +``` ### New identifier conventions Although, we are closing the identifiers rework, some resources won’t have the mentioned improvements. diff --git a/pkg/resources/oauth_integration_for_custom_clients_acceptance_test.go b/pkg/resources/oauth_integration_for_custom_clients_acceptance_test.go index 4eccc8625c..167370ef28 100644 --- a/pkg/resources/oauth_integration_for_custom_clients_acceptance_test.go +++ b/pkg/resources/oauth_integration_for_custom_clients_acceptance_test.go @@ -164,7 +164,7 @@ func TestAcc_OauthIntegrationForCustomClients_Basic(t *testing.T) { resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "blocked_roles_list.#", "3"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_issue_refresh_tokens", "true"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_refresh_token_validity", "86400"), - resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "network_policy", networkPolicy.ID().Name()), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_client_rsa_public_key", key), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_client_rsa_public_key_2", key), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "comment", comment), @@ -189,7 +189,7 @@ func TestAcc_OauthIntegrationForCustomClients_Basic(t *testing.T) { // resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.blocked_roles_list.0.value"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_issue_refresh_tokens.0.value", "true"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_refresh_token_validity.0.value", "86400"), - resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.network_policy.0.value", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.network_policy.0.value", networkPolicy.ID().Name()), resource.TestCheckResourceAttrSet("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_client_rsa_public_key_fp.0.value"), resource.TestCheckResourceAttrSet("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_client_rsa_public_key_2_fp.0.value"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.comment.0.value", comment), @@ -218,7 +218,7 @@ func TestAcc_OauthIntegrationForCustomClients_Basic(t *testing.T) { importchecks.TestCheckResourceAttrInstanceState(id.Name(), "blocked_roles_list.#", "3"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "oauth_issue_refresh_tokens", "true"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "oauth_refresh_token_validity", "86400"), - importchecks.TestCheckResourceAttrInstanceState(id.Name(), "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + importchecks.TestCheckResourceAttrInstanceState(id.Name(), "network_policy", networkPolicy.ID().Name()), importchecks.TestCheckResourceAttrNotInInstanceState(id.Name(), "oauth_client_rsa_public_key"), importchecks.TestCheckResourceAttrNotInInstanceState(id.Name(), "oauth_client_rsa_public_key_2"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "comment", comment), @@ -268,7 +268,7 @@ func TestAcc_OauthIntegrationForCustomClients_Basic(t *testing.T) { resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "blocked_roles_list.#", "3"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_issue_refresh_tokens", "true"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_refresh_token_validity", "86400"), - resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "network_policy", networkPolicy.ID().Name()), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_client_rsa_public_key", key), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_client_rsa_public_key_2", key), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "comment", comment), @@ -293,7 +293,7 @@ func TestAcc_OauthIntegrationForCustomClients_Basic(t *testing.T) { // resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.blocked_roles_list.0.value"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_issue_refresh_tokens.0.value", "true"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_refresh_token_validity.0.value", "86400"), - resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.network_policy.0.value", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.network_policy.0.value", networkPolicy.ID().Name()), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_client_rsa_public_key_fp.0.value", ""), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_client_rsa_public_key_2_fp.0.value", ""), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.comment.0.value", comment), @@ -425,7 +425,7 @@ func TestAcc_OauthIntegrationForCustomClients_Complete(t *testing.T) { resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "blocked_roles_list.#", "3"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_issue_refresh_tokens", "true"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_refresh_token_validity", "86400"), - resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "network_policy", networkPolicy.ID().Name()), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_client_rsa_public_key", key), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "oauth_client_rsa_public_key_2", key), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "comment", comment), @@ -450,7 +450,7 @@ func TestAcc_OauthIntegrationForCustomClients_Complete(t *testing.T) { // resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.blocked_roles_list.0.value"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_issue_refresh_tokens.0.value", "true"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_refresh_token_validity.0.value", "86400"), - resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.network_policy.0.value", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.network_policy.0.value", networkPolicy.ID().Name()), resource.TestCheckResourceAttrSet("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_client_rsa_public_key_fp.0.value"), resource.TestCheckResourceAttrSet("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.oauth_client_rsa_public_key_2_fp.0.value"), resource.TestCheckResourceAttr("snowflake_oauth_integration_for_custom_clients.test", "describe_output.0.comment.0.value", comment), @@ -479,7 +479,7 @@ func TestAcc_OauthIntegrationForCustomClients_Complete(t *testing.T) { importchecks.TestCheckResourceAttrInstanceState(id.Name(), "blocked_roles_list.#", "3"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "oauth_issue_refresh_tokens", "true"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "oauth_refresh_token_validity", "86400"), - importchecks.TestCheckResourceAttrInstanceState(id.Name(), "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + importchecks.TestCheckResourceAttrInstanceState(id.Name(), "network_policy", networkPolicy.ID().Name()), importchecks.TestCheckResourceAttrNotInInstanceState(id.Name(), "oauth_client_rsa_public_key"), importchecks.TestCheckResourceAttrNotInInstanceState(id.Name(), "oauth_client_rsa_public_key_2"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "comment", comment), diff --git a/pkg/resources/scim_integration_acceptance_test.go b/pkg/resources/scim_integration_acceptance_test.go index 1ae06e9413..4408602aa3 100644 --- a/pkg/resources/scim_integration_acceptance_test.go +++ b/pkg/resources/scim_integration_acceptance_test.go @@ -106,7 +106,7 @@ func TestAcc_ScimIntegration_basic(t *testing.T) { resource.TestCheckResourceAttr("snowflake_scim_integration.test", "enabled", "true"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "scim_client", "OKTA"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "run_as_role", role2.Name()), - resource.TestCheckResourceAttr("snowflake_scim_integration.test", "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_scim_integration.test", "network_policy", networkPolicy.ID().Name()), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "sync_password", "false"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "comment", "foo"), @@ -120,7 +120,7 @@ func TestAcc_ScimIntegration_basic(t *testing.T) { resource.TestCheckResourceAttr("snowflake_scim_integration.test", "describe_output.#", "1"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "describe_output.0.enabled.0.value", "true"), - resource.TestCheckResourceAttr("snowflake_scim_integration.test", "describe_output.0.network_policy.0.value", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_scim_integration.test", "describe_output.0.network_policy.0.value", networkPolicy.ID().Name()), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "describe_output.0.run_as_role.0.value", role2.Name()), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "describe_output.0.sync_password.0.value", "false"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "describe_output.0.comment.0.value", "foo"), @@ -138,7 +138,7 @@ func TestAcc_ScimIntegration_basic(t *testing.T) { importchecks.TestCheckResourceAttrInstanceState(id.Name(), "enabled", "true"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "scim_client", "OKTA"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "run_as_role", role2.Name()), - importchecks.TestCheckResourceAttrInstanceState(id.Name(), "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + importchecks.TestCheckResourceAttrInstanceState(id.Name(), "network_policy", networkPolicy.ID().Name()), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "sync_password", "false"), importchecks.TestCheckResourceAttrInstanceState(id.Name(), "comment", "foo"), ), @@ -194,7 +194,7 @@ func TestAcc_ScimIntegration_complete(t *testing.T) { resource.TestCheckResourceAttr("snowflake_scim_integration.test", "enabled", "false"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "scim_client", "GENERIC"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "run_as_role", role.Name()), - resource.TestCheckResourceAttr("snowflake_scim_integration.test", "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_scim_integration.test", "network_policy", networkPolicy.ID().Name()), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "sync_password", "false"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "comment", "foo"), ), @@ -241,7 +241,7 @@ func TestAcc_ScimIntegration_completeAzure(t *testing.T) { resource.TestCheckResourceAttr("snowflake_scim_integration.test", "enabled", "false"), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "scim_client", string(sdk.ScimSecurityIntegrationScimClientAzure)), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "run_as_role", role.Name()), - resource.TestCheckResourceAttr("snowflake_scim_integration.test", "network_policy", sdk.NewAccountObjectIdentifier(networkPolicy.Name).Name()), // TODO(SNOW-999049): Fix during identifiers rework + resource.TestCheckResourceAttr("snowflake_scim_integration.test", "network_policy", networkPolicy.ID().Name()), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "sync_password", r.BooleanDefault), resource.TestCheckResourceAttr("snowflake_scim_integration.test", "comment", "foo"), ), diff --git a/pkg/resources/table_constraint.go b/pkg/resources/table_constraint.go index f929dabcf6..415322c9fd 100644 --- a/pkg/resources/table_constraint.go +++ b/pkg/resources/table_constraint.go @@ -211,7 +211,7 @@ func (v *tableConstraintID) parse(s string) { func getTableIdentifier(s string) (*sdk.SchemaObjectIdentifier, error) { var objectIdentifier sdk.ObjectIdentifier var err error - // TODO [SNOW-999049]: Fallback for old implementations using table.id instead of table.fully_qualified_name - probably will be removed later. + // TODO [SNOW-1348114]: Address during table rework; Fallback for old implementations using table.id instead of table.fully_qualified_name - probably will be removed later. if strings.Contains(s, "|") { objectIdentifier = helpers.DecodeSnowflakeID(s) } else { diff --git a/pkg/sdk/failover_groups.go b/pkg/sdk/failover_groups.go index 9ff342b2c8..bf88d84c54 100644 --- a/pkg/sdk/failover_groups.go +++ b/pkg/sdk/failover_groups.go @@ -602,7 +602,7 @@ func (v *failoverGroups) ShowShares(ctx context.Context, id AccountObjectIdentif } resultList := make([]AccountObjectIdentifier, len(dest)) for i, r := range dest { - // TODO [SNOW-999049]: this was not working correctly with identifiers containing `.` character + // TODO [SNOW-1348343]: change during failover groups rework; this was not working correctly with identifiers containing `.` character resultList[i] = NewExternalObjectIdentifier(NewAccountIdentifierFromFullyQualifiedName(r.OwnerAccount), NewAccountObjectIdentifier(r.Name)).objectIdentifier.(AccountObjectIdentifier) } return resultList, nil diff --git a/pkg/sdk/identifier_helpers.go b/pkg/sdk/identifier_helpers.go index 58665d26d0..95ea8e894f 100644 --- a/pkg/sdk/identifier_helpers.go +++ b/pkg/sdk/identifier_helpers.go @@ -1,7 +1,6 @@ package sdk import ( - "encoding/csv" "fmt" "log" "strings" @@ -16,33 +15,6 @@ type ObjectIdentifier interface { FullyQualifiedName() string } -// TODO(SNOW-999049): This function will be tested/improved/used more wiedely during the identifiers rework. -// Right now, the implementation is just a copy of DecodeSnowflakeParameterID used in resources. -func ParseObjectIdentifier(identifier string) (ObjectIdentifier, error) { - reader := csv.NewReader(strings.NewReader(identifier)) - reader.Comma = '.' - lines, err := reader.ReadAll() - if err != nil { - return nil, fmt.Errorf("unable to read identifier: %s, err = %w", identifier, err) - } - if len(lines) != 1 { - return nil, fmt.Errorf("incompatible identifier: %s", identifier) - } - parts := lines[0] - switch len(parts) { - case 1: - return NewAccountObjectIdentifier(parts[0]), nil - case 2: - return NewDatabaseObjectIdentifier(parts[0], parts[1]), nil - case 3: - return NewSchemaObjectIdentifier(parts[0], parts[1], parts[2]), nil - case 4: - return NewTableColumnIdentifier(parts[0], parts[1], parts[2], parts[3]), nil - default: - return nil, fmt.Errorf("unable to classify identifier: %s", identifier) - } -} - func NewObjectIdentifierFromFullyQualifiedName(fullyQualifiedName string) ObjectIdentifier { parts := strings.Split(fullyQualifiedName, ".") switch len(parts) { diff --git a/pkg/sdk/identifier_parsers.go b/pkg/sdk/identifier_parsers.go index dc47009c6a..a1b7bc13fb 100644 --- a/pkg/sdk/identifier_parsers.go +++ b/pkg/sdk/identifier_parsers.go @@ -69,7 +69,6 @@ func ParseAccountObjectIdentifier(identifier string) (AccountObjectIdentifier, e ) } -// TODO(SNOW-1495053): Replace ParseObjectIdentifier // ParseObjectIdentifierString tries to guess the identifier by the number of parts it contains. // Because of the overlapping, in some cases, the output ObjectIdentifier can be one of the following implementations: // - AccountObjectIdentifier for one part diff --git a/pkg/sdk/policy_references_test.go b/pkg/sdk/policy_references_test.go index d67aac1eea..5e00285e97 100644 --- a/pkg/sdk/policy_references_test.go +++ b/pkg/sdk/policy_references_test.go @@ -116,7 +116,7 @@ func TestPolicyReferencesGetForEntity(t *testing.T) { }) } -// TODO [SNOW-999049]: check during the identifiers rework +// TODO [SNOW-1569516]: make nicer during the identifiers rework follow up func temporaryReplace(id SchemaObjectIdentifier) string { return strings.ReplaceAll(id.FullyQualifiedName(), `"`, `\"`) } diff --git a/pkg/sdk/tag_association_validations.go b/pkg/sdk/tag_association_validations.go index 19d9bca9ff..f4a2d1e33f 100644 --- a/pkg/sdk/tag_association_validations.go +++ b/pkg/sdk/tag_association_validations.go @@ -35,7 +35,7 @@ var ( ObjectTypeColumn, ObjectTypeEventTable, } - // TODO(SNOW-999049): Object types should be able tell their id structure and tagAssociationAllowedObjectTypes should be used to filter correct object types. + // TODO(SNOW-1229218): Object types should be able tell their id structure and tagAssociationAllowedObjectTypes should be used to filter correct object types. TagAssociationTagObjectTypeIsSchemaObjectType = []ObjectType{ ObjectTypeAlert, ObjectTypeExternalFunction, diff --git a/pkg/sdk/testint/cortex_search_services_integration_test.go b/pkg/sdk/testint/cortex_search_services_integration_test.go index 6397a86865..52910aaf08 100644 --- a/pkg/sdk/testint/cortex_search_services_integration_test.go +++ b/pkg/sdk/testint/cortex_search_services_integration_test.go @@ -79,8 +79,8 @@ func TestInt_CortexSearchServices(t *testing.T) { assert.NotEmpty(t, cortexSearchServiceDetails.CreatedOn) assert.Equal(t, cortexSearchService.Name, cortexSearchServiceDetails.Name) // Yes, the names are exchanged on purpose, because now it works like this - assert.Equal(t, cortexSearchService.DatabaseName, cortexSearchServiceDetails.SchemaName) - assert.Equal(t, cortexSearchService.SchemaName, cortexSearchServiceDetails.DatabaseName) + assert.Equal(t, cortexSearchService.DatabaseName, cortexSearchServiceDetails.DatabaseName) + assert.Equal(t, cortexSearchService.SchemaName, cortexSearchServiceDetails.SchemaName) assert.Equal(t, targetLag, cortexSearchServiceDetails.TargetLag) assert.NotEmpty(t, cortexSearchServiceDetails.Warehouse) assert.Equal(t, strings.ToUpper(on), *cortexSearchServiceDetails.SearchColumn) diff --git a/pkg/sdk/testint/streamlits_integration_test.go b/pkg/sdk/testint/streamlits_integration_test.go index 5f9e9435ac..ac4a4ac70d 100644 --- a/pkg/sdk/testint/streamlits_integration_test.go +++ b/pkg/sdk/testint/streamlits_integration_test.go @@ -329,7 +329,7 @@ func TestInt_Streamlits(t *testing.T) { require.Equal(t, e.Name, detail.Name) require.Equal(t, e.UrlId, detail.UrlId) require.Equal(t, mainFile, detail.MainFile) - // TODO [SNOW-999049]: make nicer during the identifiers rework + // TODO [SNOW-1569516]: make nicer during the identifiers rework follow up require.Equal(t, stage.ID().FullyQualifiedName(), sdk.NewSchemaObjectIdentifierFromFullyQualifiedName(detail.RootLocation[1:]).FullyQualifiedName()) require.Empty(t, detail.Title) require.Empty(t, detail.QueryWarehouse) diff --git a/pkg/sdk/testint/streams_gen_integration_test.go b/pkg/sdk/testint/streams_gen_integration_test.go index 6b5548c0ba..618f0c5a62 100644 --- a/pkg/sdk/testint/streams_gen_integration_test.go +++ b/pkg/sdk/testint/streams_gen_integration_test.go @@ -46,7 +46,7 @@ func TestInt_Streams(t *testing.T) { s, err := client.Streams.ShowByID(ctx, id) require.NoError(t, err) - // TODO [SNOW-999049]: make nicer during the identifiers rework + // TODO [SNOW-1348112]: make nicer during the stream rework assert.Equal(t, table.ID().FullyQualifiedName(), sdk.NewSchemaObjectIdentifierFromFullyQualifiedName(*s.TableName).FullyQualifiedName()) assertStream(t, s, id, "Table", "DEFAULT") }) @@ -77,7 +77,7 @@ func TestInt_Streams(t *testing.T) { s, err := client.Streams.ShowByID(ctx, id) require.NoError(t, err) - // TODO [SNOW-999049]: make nicer during the identifiers rework + // TODO [SNOW-1348112]: make nicer during the stream rework assert.Equal(t, externalTableId.FullyQualifiedName(), sdk.NewSchemaObjectIdentifierFromFullyQualifiedName(*s.TableName).FullyQualifiedName()) assertStream(t, s, id, "External Table", "INSERT_ONLY") }) @@ -148,7 +148,7 @@ func TestInt_Streams(t *testing.T) { require.NoError(t, err) assertStream(t, s, cloneId, "Table", "DEFAULT") - // TODO [SNOW-999049]: make nicer during the identifiers rework + // TODO [SNOW-1348112]: make nicer during the stream rework assert.Equal(t, table.ID().FullyQualifiedName(), sdk.NewSchemaObjectIdentifierFromFullyQualifiedName(*s.TableName).FullyQualifiedName()) }) @@ -414,7 +414,7 @@ func TestInt_Streams(t *testing.T) { assert.Equal(t, schema.Name, s.SchemaName) assert.Nil(t, s.TableOn) assert.Equal(t, "some comment", *s.Comment) - // TODO [SNOW-999049]: make nicer during the identifiers rework + // TODO [SNOW-1348112]: make nicer during the stream rework assert.Equal(t, table.ID().FullyQualifiedName(), sdk.NewSchemaObjectIdentifierFromFullyQualifiedName(*s.TableName).FullyQualifiedName()) assert.Equal(t, "Table", *s.SourceType) assert.Equal(t, "DEFAULT", *s.Mode) diff --git a/pkg/sdk/testint/tables_integration_test.go b/pkg/sdk/testint/tables_integration_test.go index f6a6f08ce9..4a3dcf8ee4 100644 --- a/pkg/sdk/testint/tables_integration_test.go +++ b/pkg/sdk/testint/tables_integration_test.go @@ -525,7 +525,7 @@ func TestInt_Table(t *testing.T) { require.NoError(t, err) require.Equal(t, 2, len(tableDetails)) - // TODO [SNOW-999049]: make nicer during the identifiers rework + // TODO [SNOW-1348114]: make nicer during the table rework assert.Equal(t, maskingPolicy.ID().FullyQualifiedName(), sdk.NewSchemaObjectIdentifierFromFullyQualifiedName(*tableDetails[0].PolicyName).FullyQualifiedName()) alterRequest := sdk.NewAlterTableRequest(id). diff --git a/pkg/sdk/testint/views_gen_integration_test.go b/pkg/sdk/testint/views_gen_integration_test.go index 8d4510cdae..25e2e796ab 100644 --- a/pkg/sdk/testint/views_gen_integration_test.go +++ b/pkg/sdk/testint/views_gen_integration_test.go @@ -409,7 +409,7 @@ func TestInt_Views(t *testing.T) { require.NoError(t, err) assert.Equal(t, 1, len(alteredViewDetails)) - // TODO [SNOW-999049]: make nicer during the identifiers rework + // TODO [SNOW-1348118]: make nicer during the view rework assert.Equal(t, maskingPolicy.ID().FullyQualifiedName(), sdk.NewSchemaObjectIdentifierFromFullyQualifiedName(*alteredViewDetails[0].PolicyName).FullyQualifiedName()) alterRequest = sdk.NewAlterViewRequest(id).WithUnsetMaskingPolicyOnColumn(