Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Rework data types #3244

Merged
merged 49 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
32a8918
Rename files with old data type implementation
sfc-gh-asawicki Nov 29, 2024
e7fd119
Start with number data type (WIP)
sfc-gh-asawicki Nov 29, 2024
1526fe3
Extract new data types to a separate package
sfc-gh-asawicki Nov 29, 2024
a6a559a
Extract number data type to file
sfc-gh-asawicki Nov 29, 2024
aee468b
Prepare number parsing (WIP)
sfc-gh-asawicki Nov 29, 2024
1e79a5d
Test new number parsing using old test cases
sfc-gh-asawicki Nov 29, 2024
8ba5559
Add more number test cases
sfc-gh-asawicki Nov 29, 2024
a6fecbd
Add float data type and improve number
sfc-gh-asawicki Nov 29, 2024
2cffacf
Add text data type
sfc-gh-asawicki Nov 29, 2024
b7589d2
Add binary data type
sfc-gh-asawicki Nov 29, 2024
aa7316d
Add boolean data type
sfc-gh-asawicki Dec 1, 2024
7b2b672
Add date data type
sfc-gh-asawicki Dec 1, 2024
d53abcc
Add time data type
sfc-gh-asawicki Dec 1, 2024
75453a8
Add timestamp ltz data type
sfc-gh-asawicki Dec 1, 2024
d94dd5c
Add timestamp ntz data type
sfc-gh-asawicki Dec 1, 2024
c4429f6
Add timestamp tz data type
sfc-gh-asawicki Dec 1, 2024
3fcc093
Add precision to all timestamp types
sfc-gh-asawicki Dec 1, 2024
e4bf46e
Add variant data type
sfc-gh-asawicki Dec 1, 2024
afd6e37
Add object data type
sfc-gh-asawicki Dec 1, 2024
1d5f0cd
Add array data type
sfc-gh-asawicki Dec 1, 2024
b0fc671
Add geography and geometry data types
sfc-gh-asawicki Dec 1, 2024
b1128b8
Add vector data type
sfc-gh-asawicki Dec 2, 2024
9f3a968
Add to sql and legacy to sql methods
sfc-gh-asawicki Dec 2, 2024
939d9b3
Add TODOs
sfc-gh-asawicki Dec 2, 2024
add5256
Add short description
sfc-gh-asawicki Dec 2, 2024
fdd32ff
Add data type integration tests (WIP)
sfc-gh-asawicki Dec 2, 2024
4fd0e7d
Add data type integration tests (WIP 2)
sfc-gh-asawicki Dec 2, 2024
0139d48
Add final data type integration tests
sfc-gh-asawicki Dec 2, 2024
63d5214
Use new data type in a few places
sfc-gh-asawicki Dec 2, 2024
da51c2a
Use new data type in a few places more
sfc-gh-asawicki Dec 2, 2024
fc2aa8c
Add TODO
sfc-gh-asawicki Dec 2, 2024
754ed08
Extract data type diff suppression generic func
sfc-gh-asawicki Dec 2, 2024
d25d918
Replace all existing old ToDataType invocations
sfc-gh-asawicki Dec 2, 2024
f68cf02
Return proper legacy data type for each type
sfc-gh-asawicki Dec 2, 2024
d985b2f
Add TODOs as reminder
sfc-gh-asawicki Dec 2, 2024
d8cb818
Add helper and update the tests
sfc-gh-asawicki Dec 3, 2024
9b8e017
Remove unused methods from legacy data type
sfc-gh-asawicki Dec 3, 2024
d7cea4b
Replace legacy method in two places
sfc-gh-asawicki Dec 3, 2024
d4e736c
Add tests for comparison
sfc-gh-asawicki Dec 3, 2024
dd401cc
Fix time data type
sfc-gh-asawicki Dec 3, 2024
e814032
Add issue number to TODOs
sfc-gh-asawicki Dec 3, 2024
9dbe62d
Run make pre-push
sfc-gh-asawicki Dec 3, 2024
ac1c372
Add migration guide
sfc-gh-asawicki Dec 3, 2024
9c3087c
Revert legacy DataType in external table due to #2334
sfc-gh-asawicki Dec 3, 2024
e66a936
Don't use slices.Concat (we still use go 1.21)
sfc-gh-asawicki Dec 3, 2024
189a6f0
Fix integration tests
sfc-gh-asawicki Dec 3, 2024
e0a90e7
Fix after review
sfc-gh-asawicki Dec 4, 2024
6a5ba55
Fix after review
sfc-gh-asawicki Dec 4, 2024
9f76d27
Merge branch 'main' into rework-data-types
sfc-gh-asawicki Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,35 @@ across different versions.

> [!TIP]
> We highly recommend upgrading the versions one by one instead of bulk upgrades.


## v0.99.0 ➞ v0.100.0

### Data type changes

As part of reworking functions, procedures, and any other resource utilizing Snowflake data types, we adjusted the parsing of data types to be more aligned with Snowflake (according to [docs](https://docs.snowflake.com/en/sql-reference/intro-summary-data-types)).

Affected resources:
- `snowflake_function`
- `snowflake_procedure`
- `snowflake_table`
- `snowflake_external_function`
- `snowflake_masking_policy`
- `snowflake_row_access_policy`
- `snowflake_dynamic_table`
You may encounter non-empty plans in these resources after bumping.

Changes to the previous implementation/limitations:
- `BOOL` is no longer supported; use `BOOLEAN` instead.
- Following the change described [here](#bugfix-handle-data-type-diff-suppression-better-for-text-and-number), comparing and suppressing changes of data types was extended for all other data types with the following rules:
- `CHARACTER`, `CHAR`, `NCHAR` now have the default size set to 1 if not provided (following the [docs](https://docs.snowflake.com/en/sql-reference/data-types-text#char-character-nchar))
- `BINARY` has default size set to 8388608 if not provided (following the [docs](https://docs.snowflake.com/en/sql-reference/data-types-text#binary))
- `TIME` has default precision set to 9 if not provided (following the [docs](https://docs.snowflake.com/en/sql-reference/data-types-datetime#time))
- `TIMESTAMP_LTZ` has default precision set to 9 if not provided (following the [docs](https://docs.snowflake.com/en/sql-reference/data-types-datetime#timestamp)); supported aliases: `TIMESTAMPLTZ`, `TIMESTAMP WITH LOCAL TIME ZONE`.
- `TIMESTAMP_NTZ` has default precision set to 9 if not provided (following the [docs](https://docs.snowflake.com/en/sql-reference/data-types-datetime#timestamp)); supported aliases: `TIMESTAMPNTZ`, `TIMESTAMP WITHOUT TIME ZONE`, `DATETIME`.
- `TIMESTAMP_TZ` has default precision set to 9 if not provided (following the [docs](https://docs.snowflake.com/en/sql-reference/data-types-datetime#timestamp)); supported aliases: `TIMESTAMPTZ`, `TIMESTAMP WITH TIME ZONE`.
- The session-settable `TIMESTAMP` is NOT supported ([docs](https://docs.snowflake.com/en/sql-reference/data-types-datetime#timestamp))
- `VECTOR` type still is limited and will be addressed soon (probably before the release so it will be edited)

## v0.98.0 ➞ v0.99.0

### snowflake_tasks data source changes
Expand Down
3 changes: 2 additions & 1 deletion pkg/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ func DecodeSnowflakeAccountIdentifier(identifier string) (sdk.AccountIdentifier,
}
}

// TODO: use slices.Concat in Go 1.22
// ConcatSlices is a temporary replacement for slices.Concat that will be available after we migrate to Go 1.22.
// TODO [SNOW-1844769]: use slices.Concat
func ConcatSlices[T any](slices ...[]T) []T {
var tmp []T
for _, s := range slices {
Expand Down
24 changes: 23 additions & 1 deletion pkg/resources/diff_suppressions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ import (
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/helpers"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/collections"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func NormalizeAndCompare[T comparable](normalize func(string) (T, error)) schema.SchemaDiffSuppressFunc {
return NormalizeAndCompareUsingFunc(normalize, func(a, b T) bool { return a == b })
}

func NormalizeAndCompareUsingFunc[T any](normalize func(string) (T, error), compareFunc func(a, b T) bool) schema.SchemaDiffSuppressFunc {
return func(_, oldValue, newValue string, _ *schema.ResourceData) bool {
oldNormalized, err := normalize(oldValue)
if err != nil {
Expand All @@ -22,10 +27,15 @@ func NormalizeAndCompare[T comparable](normalize func(string) (T, error)) schema
if err != nil {
return false
}
return oldNormalized == newNormalized

return compareFunc(oldNormalized, newNormalized)
}
}

// DiffSuppressDataTypes handles data type suppression taking into account data type attributes for each type.
// It falls back to Snowflake defaults for arguments if no arguments were provided for the data type.
var DiffSuppressDataTypes = NormalizeAndCompareUsingFunc(datatypes.ParseDataType, datatypes.AreTheSame)

// NormalizeAndCompareIdentifiersInSet is a diff suppression function that should be used at top-level TypeSet fields that
// hold identifiers to avoid diffs like:
// - "DATABASE"."SCHEMA"."OBJECT"
Expand Down Expand Up @@ -254,3 +264,15 @@ func IgnoreNewEmptyListOrSubfields(ignoredSubfields ...string) schema.SchemaDiff
return len(parts) == 3 && slices.Contains(ignoredSubfields, parts[2]) && new == ""
}
}

func ignoreTrimSpaceSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
return strings.TrimSpace(old) == strings.TrimSpace(new)
}

func ignoreCaseSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
return strings.EqualFold(old, new)
}

func ignoreCaseAndTrimSpaceSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
return strings.EqualFold(strings.TrimSpace(old), strings.TrimSpace(new))
}
12 changes: 6 additions & 6 deletions pkg/resources/external_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"strconv"
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/provider"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/schemas"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -227,11 +227,11 @@ func CreateContextExternalFunction(ctx context.Context, d *schema.ResourceData,
for _, arg := range v.([]interface{}) {
argName := arg.(map[string]interface{})["name"].(string)
argType := arg.(map[string]interface{})["type"].(string)
argDataType, err := sdk.ToDataType(argType)
argDataType, err := datatypes.ParseDataType(argType)
if err != nil {
return diag.FromErr(err)
}
args = append(args, sdk.ExternalFunctionArgumentRequest{ArgName: argName, ArgDataType: argDataType})
args = append(args, sdk.ExternalFunctionArgumentRequest{ArgName: argName, ArgDataType: sdk.LegacyDataTypeFrom(argDataType)})
}
}
argTypes := make([]sdk.DataType, 0, len(args))
Expand All @@ -241,13 +241,13 @@ func CreateContextExternalFunction(ctx context.Context, d *schema.ResourceData,
id := sdk.NewSchemaObjectIdentifierWithArguments(database, schemaName, name, argTypes...)

returnType := d.Get("return_type").(string)
resultDataType, err := sdk.ToDataType(returnType)
resultDataType, err := datatypes.ParseDataType(returnType)
if err != nil {
return diag.FromErr(err)
}
apiIntegration := sdk.NewAccountObjectIdentifier(d.Get("api_integration").(string))
urlOfProxyAndResource := d.Get("url_of_proxy_and_resource").(string)
req := sdk.NewCreateExternalFunctionRequest(id.SchemaObjectId(), resultDataType, &apiIntegration, urlOfProxyAndResource)
req := sdk.NewCreateExternalFunctionRequest(id.SchemaObjectId(), sdk.LegacyDataTypeFrom(resultDataType), &apiIntegration, urlOfProxyAndResource)

// Set optionals
if len(args) > 0 {
Expand Down
5 changes: 3 additions & 2 deletions pkg/resources/external_function_state_upgraders.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
)

type v085ExternalFunctionId struct {
Expand Down Expand Up @@ -52,11 +53,11 @@ func v085ExternalFunctionStateUpgrader(ctx context.Context, rawState map[string]
argDataTypes := make([]sdk.DataType, 0)
if parsedV085ExternalFunctionId.ExternalFunctionArgTypes != "" {
for _, argType := range strings.Split(parsedV085ExternalFunctionId.ExternalFunctionArgTypes, "-") {
argDataType, err := sdk.ToDataType(argType)
argDataType, err := datatypes.ParseDataType(argType)
if err != nil {
return nil, err
}
argDataTypes = append(argDataTypes, argDataType)
argDataTypes = append(argDataTypes, sdk.LegacyDataTypeFrom(argDataType))
}
}

Expand Down
21 changes: 9 additions & 12 deletions pkg/resources/external_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ import (
"fmt"
"log"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/helpers"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/provider"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/schemas"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/helpers"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)

var externalTableSchema = map[string]*schema.Schema{
Expand Down Expand Up @@ -59,11 +56,11 @@ var externalTableSchema = map[string]*schema.Schema{
ForceNew: true,
},
"type": {
Type: schema.TypeString,
Required: true,
Description: "Column type, e.g. VARIANT",
ForceNew: true,
ValidateFunc: IsDataType(),
Type: schema.TypeString,
Required: true,
Description: "Column type, e.g. VARIANT",
ForceNew: true,
ValidateDiagFunc: IsDataTypeValid,
},
"as": {
Type: schema.TypeString,
Expand Down
20 changes: 10 additions & 10 deletions pkg/resources/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"regexp"
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/provider"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/schemas"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/snowflake"
"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand Down Expand Up @@ -311,7 +311,7 @@ func createScalaFunction(ctx context.Context, d *schema.ResourceData, meta inter
functionDefinition := d.Get("statement").(string)
sfc-gh-jmichalak marked this conversation as resolved.
Show resolved Hide resolved
handler := d.Get("handler").(string)
// create request with required
request := sdk.NewCreateForScalaFunctionRequest(id, returnDataType, handler)
request := sdk.NewCreateForScalaFunctionRequest(id, sdk.LegacyDataTypeFrom(returnDataType), handler)
request.WithFunctionDefinition(functionDefinition)

// Set optionals
Expand Down Expand Up @@ -739,16 +739,16 @@ func parseFunctionArguments(d *schema.ResourceData) ([]sdk.FunctionArgumentReque
if diags != nil {
return nil, diags
}
args = append(args, sdk.FunctionArgumentRequest{ArgName: argName, ArgDataType: argDataType})
args = append(args, sdk.FunctionArgumentRequest{ArgName: argName, ArgDataType: sdk.LegacyDataTypeFrom(argDataType)})
}
}
return args, nil
}

func convertFunctionDataType(s string) (sdk.DataType, diag.Diagnostics) {
dataType, err := sdk.ToDataType(s)
func convertFunctionDataType(s string) (datatypes.DataType, diag.Diagnostics) {
dataType, err := datatypes.ParseDataType(s)
if err != nil {
return dataType, diag.FromErr(err)
return nil, diag.FromErr(err)
}
return dataType, nil
}
Expand All @@ -759,13 +759,13 @@ func convertFunctionColumns(s string) ([]sdk.FunctionColumn, diag.Diagnostics) {
var columns []sdk.FunctionColumn
for _, match := range matches {
if len(match) == 3 {
dataType, err := sdk.ToDataType(match[2])
dataType, err := datatypes.ParseDataType(match[2])
if err != nil {
return nil, diag.FromErr(err)
}
columns = append(columns, sdk.FunctionColumn{
ColumnName: match[1],
ColumnDataType: dataType,
ColumnDataType: sdk.LegacyDataTypeFrom(dataType),
})
}
}
Expand All @@ -789,7 +789,7 @@ func parseFunctionReturnsRequest(s string) (*sdk.FunctionReturnsRequest, diag.Di
if diags != nil {
return nil, diags
}
returns.WithResultDataType(*sdk.NewFunctionReturnsResultDataTypeRequest(returnDataType))
returns.WithResultDataType(*sdk.NewFunctionReturnsResultDataTypeRequest(sdk.LegacyDataTypeFrom(returnDataType)))
}
return returns, nil
}
5 changes: 3 additions & 2 deletions pkg/resources/function_state_upgraders.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
)

type v085FunctionId struct {
Expand Down Expand Up @@ -48,11 +49,11 @@ func v085FunctionIdStateUpgrader(ctx context.Context, rawState map[string]interf

argDataTypes := make([]sdk.DataType, len(parsedV085FunctionId.ArgTypes))
for i, argType := range parsedV085FunctionId.ArgTypes {
argDataType, err := sdk.ToDataType(argType)
argDataType, err := datatypes.ParseDataType(argType)
if err != nil {
return nil, err
}
argDataTypes[i] = argDataType
argDataTypes[i] = sdk.LegacyDataTypeFrom(argDataType)
}

schemaObjectIdentifierWithArguments := sdk.NewSchemaObjectIdentifierWithArgumentsOld(parsedV085FunctionId.DatabaseName, parsedV085FunctionId.SchemaName, parsedV085FunctionId.FunctionName, argDataTypes)
Expand Down
66 changes: 0 additions & 66 deletions pkg/resources/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,13 @@ package resources
import (
"fmt"
"slices"
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/logging"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/snowflake"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataTypeValidateFunc(val interface{}, _ string) (warns []string, errs []error) {
if ok := sdk.IsValidDataType(val.(string)); !ok {
errs = append(errs, fmt.Errorf("%v is not a valid data type", val))
}
return
}

func dataTypeDiffSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
oldDT, err := sdk.ToDataType(old)
if err != nil {
return false
}
newDT, err := sdk.ToDataType(new)
if err != nil {
return false
}
return oldDT == newDT
}

// DataTypeIssue3007DiffSuppressFunc is a temporary solution to handle data type suppression problems.
// Currently, it handles only number and text data types.
// It falls back to Snowflake defaults for arguments if no arguments were provided for the data type.
// TODO [SNOW-1348103 or SNOW-1348106]: visit with functions and procedures rework
func DataTypeIssue3007DiffSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
oldDataType, err := sdk.ToDataType(old)
if err != nil {
return false
}
newDataType, err := sdk.ToDataType(new)
if err != nil {
return false
}
if oldDataType != newDataType {
return false
}
switch v := oldDataType; v {
case sdk.DataTypeNumber:
logging.DebugLogger.Printf("[DEBUG] DataTypeIssue3007DiffSuppressFunc: Handling number data type diff suppression")
oldPrecision, oldScale := sdk.ParseNumberDataTypeRaw(old)
newPrecision, newScale := sdk.ParseNumberDataTypeRaw(new)
return oldPrecision == newPrecision && oldScale == newScale
case sdk.DataTypeVARCHAR:
logging.DebugLogger.Printf("[DEBUG] DataTypeIssue3007DiffSuppressFunc: Handling text data type diff suppression")
oldLength := sdk.ParseVarcharDataTypeRaw(old)
newLength := sdk.ParseVarcharDataTypeRaw(new)
return oldLength == newLength
default:
logging.DebugLogger.Printf("[DEBUG] DataTypeIssue3007DiffSuppressFunc: Diff suppression for %s can't be currently handled", v)
}
return true
}

func ignoreTrimSpaceSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
return strings.TrimSpace(old) == strings.TrimSpace(new)
}

func ignoreCaseSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
return strings.EqualFold(old, new)
}

func ignoreCaseAndTrimSpaceSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
return strings.EqualFold(strings.TrimSpace(old), strings.TrimSpace(new))
}

func getTagObjectIdentifier(v map[string]any) sdk.ObjectIdentifier {
if _, ok := v["database"]; ok {
if _, ok := v["schema"]; ok {
Expand Down
Loading
Loading