Skip to content

Conversation

@willwwt
Copy link
Contributor

@willwwt willwwt commented Apr 7, 2023

Add get_workspace_bindings and update_workspace_bindings CLI for workspace bindings configuration.

Manual test:

(venv2.7) Q7Q6DF6LLJ:databricks-cli Weitao.Wen$ databricks --profile e2-weitao unity-catalog catalogs
Usage: databricks unity-catalog catalogs [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  create           Create a new catalog.
  delete           Delete a catalog.
  get              Get a catalog.
  get-bindings     Get workspace bindings of a catalog.
  list             List catalogs.
  update           Update a catalog.
  update-bindings  Update workspace bindings of a catalog.

(venv2.7) Q7Q6DF6LLJ:databricks-cli Weitao.Wen$ databricks unity-catalog catalogs update-bindings --name weitao-catalog --json-file update-bindings.json --profile e2-weitao
{
  "workspaces": [
    6051921418418893
  ]
}
(venv2.7) Q7Q6DF6LLJ:databricks-cli Weitao.Wen$ databricks --profile e2-weitao unity-catalog catalogs get-bindings --name weitao-catalog
{
  "workspaces": [
    6051921418418893
  ]
}
(venv2.7) Q7Q6DF6LLJ:databricks-cli Weitao.Wen$ cat update-bindings.json
{
    "assign_workspaces": [6051921418418893]
}
(venv2.7) Q7Q6DF6LLJ:databricks-cli Weitao.Wen$ vi update-bindings.json
(venv2.7) Q7Q6DF6LLJ:databricks-cli Weitao.Wen$ databricks unity-catalog catalogs update-bindings --name weitao-catalog --json-file update-bindings.json --profile e2-weitao
{}
(venv2.7) Q7Q6DF6LLJ:databricks-cli Weitao.Wen$ cat update-bindings.json
{
    "unassign_workspaces": [6051921418418893]
}
(venv2.7) Q7Q6DF6LLJ:databricks-cli Weitao.Wen$ databricks --profile e2-weitao unity-catalog catalogs get-bindings --name weitao-catalog
{}

Copy link
Contributor

@adamcain-db adamcain-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additions LGTM. @willwwt said he'd add unit tests.

@willwwt
Copy link
Contributor Author

willwwt commented Apr 12, 2023

Additions LGTM. @willwwt said he'd add unit tests.

Added unit tests in tests/unity_catalog/test_catalog_cli.py

Copy link
Contributor

@adamcain-db adamcain-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@yeshengm yeshengm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pietern pietern changed the title [SC-115857] Databricks CLI integration for configuring bindings Integration for configuring workspace bindings Apr 13, 2023
@pietern pietern merged commit 5c38791 into databricks:main Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants