Skip to content

Commit 6327308

Browse files
authored
Add user guide for new behaviours with UC by default (#3318)
* add uc by default guide * make fmt-docs
1 parent 602bff9 commit 6327308

File tree

10 files changed

+121
-24
lines changed

10 files changed

+121
-24
lines changed

docs/guides/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ If you want to enforce a specific authorization method, you can set the `auth_ty
197197
198198
```hcl
199199
provider "databricks" {
200-
...
200+
# other configurations
201201
auth_type = "pat"
202202
}
203203
```

docs/guides/unity-catalog-azure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ page_title: "Unity Catalog set up on Azure"
55
# Deploying pre-requisite resources and enabling Unity Catalog
66

77
**Note**
8-
If your workspace was enabled for Unity Catalog automatically, this guide does not apply to you.
8+
If your workspace was enabled for Unity Catalog automatically, this guide does not apply to you. See [this guide](unity-catalog-default.md) instead.
99

1010
**Note**
1111
Except for metastore, metastore assignment and storage credential objects, Unity Catalog APIs are accessible via **workspace-level APIs**. This design may change in the future.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
page_title: "Working with Unity Catalog by default"
3+
---
4+
5+
# Working with Unity Catalog by default
6+
7+
Databricks began to [enable new workspaces for Unity Catalog automatically](https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/get-started#--automatic-enablement-of-unity-catalog) on November 9, 2023, with a rollout proceeding gradually across accounts. Workspaces that were enabled automatically have the following properties:
8+
9+
- An automatically-provisioned Unity Catalog metastore (unless a Unity Catalog metastore already existed for the workspace region).
10+
- Default privileges for workspace admins, such as the ability to create a catalog or an external database connection.
11+
- No metastore admin (unless an existing Unity Catalog metastore was used and a metastore admin was already assigned).
12+
- No metastore-level storage for managed tables and managed volumes (unless an existing Unity Catalog metastore with metastore-level storage was used).
13+
- A workspace catalog, which, when originally provisioned, is named after your workspace.
14+
15+
This removes the need to manually enable Unity Catalog following [this guide](unity-catalog.md). However, you may need to adjust your Terraform configuration to account for this accordingly
16+
17+
## Removing default privileges for workspace admins
18+
19+
An account admin may decide to remove the default privileges granted to workspace admins, such as the ability to create a catalog or connection. This can be achieved using [databricks_grants](../resources/grants.md), which will override any metastore-level grants not defined in Terraform
20+
21+
```hcl
22+
data "databricks_current_metastore" "this" {
23+
}
24+
25+
resource "databricks_grants" "this" {
26+
metastore = data.databricks_metastore.this.id
27+
grant {
28+
principal = "Data Engineers"
29+
privileges = ["CREATE_CATALOG", "CREATE_EXTERNAL_LOCATION"]
30+
}
31+
grant {
32+
principal = "Data Sharer"
33+
privileges = ["CREATE_RECIPIENT", "CREATE_SHARE"]
34+
}
35+
}
36+
```
37+
38+
## Avoiding the automatically-provisioned Unity Catalog metastore
39+
40+
An account admin may pre-create metastores with specific admins in all regions that workspaces will be deployed. This will ensure that new workspaces are automatically assigned to the correct metastore
41+
42+
```hcl
43+
variable "regions" {
44+
default = ["ap-northeast-1", "eu-west-1"]
45+
}
46+
47+
resource "databricks_metastore" "this" {
48+
for_each = toset(var.regions)
49+
name = "metastore-${each.value}"
50+
region = each.value
51+
}
52+
```
53+
54+
## Mandating storage for new catalogs
55+
56+
The automatically-provisioned Unity Catalog metastore does not have metastore-level storage, which means each new catalog has to have a storage location defined
57+
58+
```hcl
59+
# this would fail with "storage location required" error
60+
resource "databricks_catalog" "sandbox" {
61+
name = "sandbox"
62+
}
63+
```
64+
65+
## Using the workspace catalog
66+
67+
The automatically-provisioned workspace catalog is named after the workspace and initially is bound to that workspace only.
68+
69+
To retrieve this catalog using [databricks_catalogs](../data-sources/catalogs.md)
70+
71+
```hcl
72+
variable workspace_name {}
73+
74+
data "databricks_catalogs" "all" {}
75+
76+
locals {
77+
default_catalog = [for each in data.databricks_catalogs.all.ids : each if strcontains(each, var.workspace_name)]
78+
}
79+
```
80+
81+
This can then be used to create objects under this catalog, e.g.
82+
83+
```hcl
84+
resource "databricks_schema" "sandbox" {
85+
catalog_name = local.default_catalog[0]
86+
name = "sandbox"
87+
}
88+
```
89+
90+
Or bind this catalog to more workspaces
91+
92+
```hcl
93+
resource "databricks_catalog_workspace_binding" "default_catalog" {
94+
securable_name = local.default_catalog[0]
95+
workspace_id = databricks_mws_workspaces.other.workspace_id
96+
}
97+
```

docs/guides/unity-catalog-gcp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ page_title: "Unity Catalog set up on Google Cloud"
55
# Deploying pre-requisite resources and enabling Unity Catalog
66

77
**Note**
8-
If your workspace was enabled for Unity Catalog automatically, this guide does not apply to you.
8+
If your workspace was enabled for Unity Catalog automatically, this guide does not apply to you. See [this guide](unity-catalog-default.md) instead.
99

1010
**Note**
1111
Except for metastore, metastore assignment and storage credential objects, Unity Catalog APIs are accessible via **workspace-level APIs**. This design may change in the future.

docs/guides/unity-catalog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ page_title: "Unity Catalog set up on AWS"
55
# Deploying pre-requisite resources and enabling Unity Catalog
66

77
**Note**
8-
If your workspace was enabled for Unity Catalog automatically, this guide does not apply to you.
8+
If your workspace was enabled for Unity Catalog automatically, this guide does not apply to you. See [this guide](unity-catalog-default.md) instead.
99

1010
**Note**
1111
Except for metastore, metastore assignment and storage credential objects, Unity Catalog APIs are accessible via **workspace-level APIs**. This design may change in the future.

docs/resources/file.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ resource "databricks_schema" "things" {
3434
}
3535
3636
resource "databricks_volume" "this" {
37-
name = "quickstart_volume"
38-
catalog_name = databricks_catalog.sandbox.name
39-
schema_name = databricks_schema.things.name
40-
volume_type = "MANAGED"
41-
comment = "this volume is managed by terraform"
37+
name = "quickstart_volume"
38+
catalog_name = databricks_catalog.sandbox.name
39+
schema_name = databricks_schema.things.name
40+
volume_type = "MANAGED"
41+
comment = "this volume is managed by terraform"
4242
}
4343
4444
resource "databricks_file" "this" {
@@ -56,7 +56,7 @@ resource "databricks_file" "init_script" {
5656
echo "Hello World"
5757
EOT
5858
)
59-
path = "${databricks_volume.this.volume_path}/fileName"
59+
path = "${databricks_volume.this.volume_path}/fileName"
6060
}
6161
```
6262

docs/resources/grants.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ You can grant `CREATE_CATALOG`, `CREATE_CONNECTION`, `CREATE_EXTERNAL_LOCATION`,
3535

3636
```hcl
3737
resource "databricks_grants" "sandbox" {
38-
metastore = "metastore_id"
38+
metastore = "metastore_id"
3939
grant {
4040
principal = "Data Engineers"
4141
privileges = ["CREATE_CATALOG", "CREATE_EXTERNAL_LOCATION"]

docs/resources/share.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ Creating a Delta Sharing share and add a schema to it(including all current and
3737

3838
```hcl
3939
resource "databricks_share" "schema_share" {
40-
name = "schema_share"
41-
object {
42-
name = "catalog_name.schema_name"
43-
data_object_type = "SCHEMA"
44-
history_data_sharing_status = "ENABLED"
45-
}
40+
name = "schema_share"
41+
object {
42+
name = "catalog_name.schema_name"
43+
data_object_type = "SCHEMA"
44+
history_data_sharing_status = "ENABLED"
45+
}
4646
}
4747
```
4848

docs/resources/sql_widget.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ A widget is always tied to a [dashboard](sql_dashboard.md). Every dashboard may
1414
```hcl
1515
resource "databricks_sql_widget" "d1w1" {
1616
dashboard_id = databricks_sql_dashboard.d1.id
17-
text = "Hello! I'm a **text widget**!"
17+
text = "Hello! I'm a **text widget**!"
1818
1919
position {
2020
size_x = 3
2121
size_y = 4
22-
pos_x = 0
23-
pos_y = 0
22+
pos_x = 0
23+
pos_y = 0
2424
}
2525
}
2626
2727
resource "databricks_sql_widget" "d1w2" {
28-
dashboard_id = databricks_sql_dashboard.d1.id
28+
dashboard_id = databricks_sql_dashboard.d1.id
2929
visualization_id = databricks_sql_visualization.q1v1.id
3030
3131
position {
3232
size_x = 3
3333
size_y = 4
34-
pos_x = 3
35-
pos_y = 0
34+
pos_x = 3
35+
pos_y = 0
3636
}
3737
}
3838
```

docs/resources/vector_search_endpoint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This resource allows you to create [Vector Search Endpoint](https://docs.databri
1111

1212
```hcl
1313
resource "databricks_vector_search_endpoint" "this" {
14-
name = "vector-search-test"
14+
name = "vector-search-test"
1515
endpoint_type = "STANDARD"
1616
}
1717
```

0 commit comments

Comments
 (0)