-
Notifications
You must be signed in to change notification settings - Fork 26
[USTORAGE-11846] : Update CLI for tableflow catalog integration #3330
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,21 +32,24 @@ | |
| cmd.Flags().String("name", "", "Name of the catalog integration.") | ||
| cmd.Flags().String("endpoint", "", "Specify the The catalog integration connection endpoint for Snowflake Open Catalog.") | ||
| cmd.Flags().String("warehouse", "", "Specify the warehouse name of the Snowflake Open Catalog.") | ||
| cmd.Flags().String("allowed-scope", "", "Specify the allowed scope of the Snowflake Open Catalog.") | ||
|
Check failure on line 35 in internal/tableflow/command_catalog_integration_update.go
|
||
| cmd.Flags().String("client-id", "", "Specify the client id.") | ||
|
Check failure on line 36 in internal/tableflow/command_catalog_integration_update.go
|
||
| cmd.Flags().String("client-secret", "", "Specify the client secret.") | ||
|
Check failure on line 37 in internal/tableflow/command_catalog_integration_update.go
|
||
| cmd.Flags().String("custom-database", "", "Specify the custom database name for AWS Glue.") | ||
|
Check failure on line 38 in internal/tableflow/command_catalog_integration_update.go
|
||
| cmd.Flags().String("custom-namespace", "", "Specify the custom namespace for Snowflake Open Catalog.") | ||
|
Check failure on line 39 in internal/tableflow/command_catalog_integration_update.go
|
||
| cmd.Flags().String("custom-schema", "", "Specify the custom schema name for Unity Catalog.") | ||
|
Check failure on line 40 in internal/tableflow/command_catalog_integration_update.go
|
||
|
|
||
| pcmd.AddClusterFlag(cmd, c.AuthenticatedCLICommand) | ||
| pcmd.AddEnvironmentFlag(cmd, c.AuthenticatedCLICommand) | ||
| pcmd.AddContextFlag(cmd, c.CLICommand) | ||
| pcmd.AddOutputFlag(cmd) | ||
|
|
||
| cmd.MarkFlagsOneRequired("name", "endpoint", "warehouse", "allowed-scope", "client-id", "client-secret") | ||
| cmd.MarkFlagsOneRequired("name", "endpoint", "warehouse", "allowed-scope", "client-id", "client-secret", "custom-database", "custom-namespace", "custom-schema") | ||
|
Comment on lines
+38
to
+47
|
||
|
|
||
| return cmd | ||
| } | ||
|
|
||
| func (c *command) updateCatalogIntegration(cmd *cobra.Command, args []string) error { | ||
|
Check failure on line 52 in internal/tableflow/command_catalog_integration_update.go
|
||
| environmentId, err := c.Context.EnvironmentId() | ||
| if err != nil { | ||
| return err | ||
|
|
@@ -95,9 +98,29 @@ | |
| }, | ||
| }) | ||
| } | ||
| if catalogIntegrationType == unity { | ||
| updateCatalogIntegration.Spec.SetConfig(tableflowv1.TableflowV1CatalogIntegrationUpdateSpecConfigOneOf{ | ||
| TableflowV1CatalogIntegrationUnityUpdateSpec: &tableflowv1.TableflowV1CatalogIntegrationUnityUpdateSpec{ | ||
| Kind: unityKind, | ||
| }, | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| if cmd.Flags().Changed("custom-database") { | ||
| customDatabase, err := cmd.Flags().GetString("custom-database") | ||
| if err != nil { | ||
| return err | ||
| } | ||
| updateCatalogIntegration.Spec.SetConfig(tableflowv1.TableflowV1CatalogIntegrationUpdateSpecConfigOneOf{ | ||
| TableflowV1CatalogIntegrationAwsGlueUpdateSpec: &tableflowv1.TableflowV1CatalogIntegrationAwsGlueUpdateSpec{ | ||
| Kind: awsGlueKind, | ||
| }, | ||
| }) | ||
| updateCatalogIntegration.Spec.Config.TableflowV1CatalogIntegrationAwsGlueUpdateSpec.SetCustomDatabase(customDatabase) | ||
| } | ||
|
|
||
| if cmd.Flags().Changed("endpoint") || cmd.Flags().Changed("warehouse") || cmd.Flags().Changed("allowed-scope") || cmd.Flags().Changed("client-id") || cmd.Flags().Changed("client-secret") { | ||
| if cmd.Flags().Changed("endpoint") || cmd.Flags().Changed("warehouse") || cmd.Flags().Changed("allowed-scope") || cmd.Flags().Changed("client-id") || cmd.Flags().Changed("client-secret") || cmd.Flags().Changed("custom-namespace") { | ||
| updateCatalogIntegration.Spec.SetConfig(tableflowv1.TableflowV1CatalogIntegrationUpdateSpecConfigOneOf{ | ||
| TableflowV1CatalogIntegrationSnowflakeUpdateSpec: &tableflowv1.TableflowV1CatalogIntegrationSnowflakeUpdateSpec{ | ||
| Kind: snowflakeKind, | ||
|
|
@@ -138,6 +161,26 @@ | |
| } | ||
| updateCatalogIntegration.Spec.Config.TableflowV1CatalogIntegrationSnowflakeUpdateSpec.SetClientSecret(clientSecret) | ||
| } | ||
| if cmd.Flags().Changed("custom-namespace") { | ||
| customNamespace, err := cmd.Flags().GetString("custom-namespace") | ||
| if err != nil { | ||
| return err | ||
| } | ||
| updateCatalogIntegration.Spec.Config.TableflowV1CatalogIntegrationSnowflakeUpdateSpec.SetCustomNamespace(customNamespace) | ||
| } | ||
| } | ||
|
|
||
| if cmd.Flags().Changed("custom-schema") { | ||
| customSchema, err := cmd.Flags().GetString("custom-schema") | ||
| if err != nil { | ||
| return err | ||
| } | ||
| updateCatalogIntegration.Spec.SetConfig(tableflowv1.TableflowV1CatalogIntegrationUpdateSpecConfigOneOf{ | ||
| TableflowV1CatalogIntegrationUnityUpdateSpec: &tableflowv1.TableflowV1CatalogIntegrationUnityUpdateSpec{ | ||
| Kind: unityKind, | ||
| }, | ||
| }) | ||
| updateCatalogIntegration.Spec.Config.TableflowV1CatalogIntegrationUnityUpdateSpec.SetCustomSchema(customSchema) | ||
| } | ||
|
|
||
| catalogIntegration, err := c.V2Client.UpdateCatalogIntegration(args[0], updateCatalogIntegration) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| +-------------------------+----------------+ | ||
| | ID | tci-abc123 | | ||
| | Name | my-aws-glue-ci | | ||
| | Environment | env-596 | | ||
| | Kafka Cluster | lkc-123456 | | ||
| | Type | aws | | ||
| | Provider Integration ID | cspi-stgce89r7 | | ||
| | Custom Database | my-custom-db | | ||
| | Suspended | false | | ||
| | Phase | PENDING | | ||
| +-------------------------+----------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| +------------------+------------------------------------------------+ | ||
| | ID | tci-def456 | | ||
| | Name | my-snowflake-ci | | ||
| | Environment | env-596 | | ||
| | Kafka Cluster | lkc-123456 | | ||
| | Type | snowflake | | ||
| | Endpoint | https://vuser1_polaris.snowflakecomputing.com/ | | ||
| | Warehouse | warehouse | | ||
| | Allowed Scope | allowed-scope | | ||
| | Custom Namespace | my-custom-ns | | ||
| | Suspended | false | | ||
| | Phase | PENDING | | ||
| +------------------+------------------------------------------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| +--------------------+------------------------------------+ | ||
| | ID | tci-ghi789 | | ||
| | Name | my-catalog-integration | | ||
| | Environment | env-596 | | ||
| | Kafka Cluster | lkc-123456 | | ||
| | Type | unity | | ||
| | Workspace Endpoint | https://dbc-1.cloud.databricks.com | | ||
| | Catalog Name | tableflow-quickstart-catalog | | ||
| | Client ID | $CLIENT_ID | | ||
| | Custom Schema | my-custom-schema | | ||
| | Suspended | false | | ||
| | Phase | PENDING | | ||
| +--------------------+------------------------------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| +---------------+------------------------------------------------+ | ||
| | ID | tci-def456 | | ||
| | Name | my-snowflake-ci | | ||
| | Environment | env-596 | | ||
| | Kafka Cluster | lkc-123456 | | ||
| | Type | snowflake | | ||
| | Endpoint | https://vuser1_polaris.snowflakecomputing.com/ | | ||
| | Warehouse | warehouse | | ||
| | Allowed Scope | allowed-scope | | ||
| | Suspended | false | | ||
| | Phase | CONNECTED | | ||
| +---------------+------------------------------------------------+ | ||
| +------------------+------------------------------------------------+ | ||
| | ID | tci-def456 | | ||
| | Name | my-snowflake-ci | | ||
| | Environment | env-596 | | ||
| | Kafka Cluster | lkc-123456 | | ||
| | Type | snowflake | | ||
| | Endpoint | https://vuser1_polaris.snowflakecomputing.com/ | | ||
| | Warehouse | warehouse | | ||
| | Allowed Scope | allowed-scope | | ||
| | Custom Namespace | my-custom-ns | | ||
| | Suspended | false | | ||
| | Phase | CONNECTED | | ||
| +------------------+------------------------------------------------+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catalogIntegrationOutnow includes Custom Database/Namespace/Schema, andprintCatalogIntegrationTablepopulates them, but the list command buildscatalogIntegrationOutmanually and doesn’t set these fields. This will causetableflow catalog-integration listto show the new columns with blank values even when the API returns them. Consider centralizing the mapping fromTableflowV1CatalogIntegration->catalogIntegrationOut(or at least populating these three fields in the list path) so list/describe output stays consistent.