Skip to content

Commit e10d36c

Browse files
authored
Update documentation for Delta Sharing resources; refactoring relevant resources & data sources (#3466)
* moving delta sharing resources to sharing namepsace * docs
1 parent 43ead70 commit e10d36c

File tree

16 files changed

+30
-27
lines changed

16 files changed

+30
-27
lines changed

docs/data-sources/share.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
subcategory: "Unity Catalog"
2+
subcategory: "Delta Sharing"
33
---
44
# databricks_share Data Source
55

docs/data-sources/shares.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
subcategory: "Unity Catalog"
2+
subcategory: "Delta Sharing"
33
---
44
# databricks_shares Data Source
55

docs/resources/provider.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
subcategory: "Unity Catalog"
2+
subcategory: "Delta Sharing"
33
---
44
# databricks_provider Resource
55

66
-> **Note** This resource could be only used with workspace-level provider!
77

8-
Within a metastore, Unity Catalog provides the ability to create a provider which contains a list of shares that have been shared with you.
8+
In Delta Sharing, a provider is an entity that shares data with a recipient. Within a metastore, Unity Catalog provides the ability to create a provider which contains a list of shares that have been shared with you.
99

1010
A `databricks_provider` is contained within [databricks_metastore](metastore.md) and can contain a list of shares that have been shared with you.
1111

docs/resources/recipient.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
2-
subcategory: "Unity Catalog"
2+
subcategory: "Delta Sharing"
33
---
44
# databricks_recipient Resource
55

66
-> **Note** This resource could be only used with workspace-level provider!
77

8-
Within a metastore, Unity Catalog provides the ability to create a recipient to attach delta shares to.
8+
In Delta Sharing, a recipient is an entity that receives shares from a provider. In Unity Catalog, a share is a securable object that represents an organization and associates it with a credential or secure sharing identifier that allows that organization to access one or more shares.
9+
10+
As a data provider (sharer), you can define multiple recipients for any given Unity Catalog metastore, but if you want to share data from multiple metastores with a particular user or group of users, you must define the recipient separately for each metastore. A recipient can have access to multiple shares.
911

1012
A `databricks_recipient` is contained within [databricks_metastore](metastore.md) and can have permissions to `SELECT` from a list of shares.
1113

@@ -113,7 +115,6 @@ In addition to all arguments above, the following attributes are exported:
113115
* `cloud` - Cloud vendor of the recipient's Unity Catalog Metstore. This field is only present when the authentication_type is `DATABRICKS`.
114116
* `region` - Cloud region of the recipient's Unity Catalog Metstore. This field is only present when the authentication_type is `DATABRICKS`.
115117

116-
117118
## Related Resources
118119

119120
The following resources are often used in the same context:

docs/resources/share.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
subcategory: "Unity Catalog"
2+
subcategory: "Delta Sharing"
33
---
44
# databricks_share Resource
55

66
-> **Note** This resource could be only used with workspace-level provider!
77

8-
Within a metastore, Unity Catalog provides the ability to create a share, which is a named object that contains a collection of tables in a metastore that you want to share as a group. A share can contain tables from only a single metastore. You can add or remove tables from a share at any time.
8+
In Delta Sharing, a share is a read-only collection of tables and table partitions that a provider wants to share with one or more recipients. If your recipient uses a Unity Catalog-enabled Databricks workspace, you can also include notebook files, views (including dynamic views that restrict access at the row and column level), Unity Catalog volumes, and Unity Catalog models in a share.
99

10-
A `databricks_share` is contained within [databricks_metastore](metastore.md) and can contain a list of tables.
10+
In a Unity Catalog-enabled Databricks workspace, a share is a securable object registered in Unity Catalog. A `databricks_share` is contained within a [databricks_metastore](metastore.md). If you remove a share from your Unity Catalog metastore, all recipients of that share lose the ability to access it.
1111

1212
## Example Usage
1313

exporter/importables.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/databricks/terraform-provider-databricks/permissions"
3030
"github.com/databricks/terraform-provider-databricks/pipelines"
3131
"github.com/databricks/terraform-provider-databricks/repos"
32+
tfsharing "github.com/databricks/terraform-provider-databricks/sharing"
3233
tfsql "github.com/databricks/terraform-provider-databricks/sql"
3334
sql_api "github.com/databricks/terraform-provider-databricks/sql/api"
3435
"github.com/databricks/terraform-provider-databricks/storage"
@@ -2730,7 +2731,7 @@ var resourcesMap map[string]importable = map[string]importable{
27302731
},
27312732
Import: func(ic *importContext, r *resource) error {
27322733
// TODO: do we need to emit the owner See comment for the owner...
2733-
var share tfcatalog.ShareInfo
2734+
var share tfsharing.ShareInfo
27342735
s := ic.Resources["databricks_share"].Schema
27352736
common.DataToStructPointer(r.Data, s, &share)
27362737
// TODO: how to link recipients to share?

exporter/importables_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/databricks/terraform-provider-databricks/repos"
3232
"github.com/databricks/terraform-provider-databricks/scim"
3333
"github.com/databricks/terraform-provider-databricks/secrets"
34+
tfsharing "github.com/databricks/terraform-provider-databricks/sharing"
3435
"github.com/databricks/terraform-provider-databricks/storage"
3536
"github.com/databricks/terraform-provider-databricks/workspace"
3637
"github.com/hashicorp/hcl/v2/hclwrite"
@@ -1771,11 +1772,11 @@ func TestImportSchema(t *testing.T) {
17711772
func TestImportShare(t *testing.T) {
17721773
ic := importContextForTest()
17731774
ic.enableServices("uc-grants,uc-volumes,uc-models,uc-tables")
1774-
d := tfcatalog.ResourceShare().ToResource().TestResourceData()
1775-
scm := tfcatalog.ResourceShare().Schema
1776-
share := tfcatalog.ShareInfo{
1775+
d := tfsharing.ResourceShare().ToResource().TestResourceData()
1776+
scm := tfsharing.ResourceShare().Schema
1777+
share := tfsharing.ShareInfo{
17771778
Name: "stest",
1778-
Objects: []tfcatalog.SharedDataObject{
1779+
Objects: []tfsharing.SharedDataObject{
17791780
{
17801781
DataObjectType: "TABLE",
17811782
Name: "ctest.stest.table1",

provider/provider.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ func DatabricksProvider() *schema.Provider {
8484
"databricks_schemas": catalog.DataSourceSchemas().ToResource(),
8585
"databricks_service_principal": scim.DataSourceServicePrincipal().ToResource(),
8686
"databricks_service_principals": scim.DataSourceServicePrincipals().ToResource(),
87-
"databricks_share": catalog.DataSourceShare().ToResource(),
88-
"databricks_shares": catalog.DataSourceShares().ToResource(),
87+
"databricks_share": sharing.DataSourceShare().ToResource(),
88+
"databricks_shares": sharing.DataSourceShares().ToResource(),
8989
"databricks_spark_version": clusters.DataSourceSparkVersion().ToResource(),
9090
"databricks_sql_warehouse": sql.DataSourceWarehouse().ToResource(),
9191
"databricks_sql_warehouses": sql.DataSourceWarehouses().ToResource(),
@@ -151,7 +151,7 @@ func DatabricksProvider() *schema.Provider {
151151
"databricks_permission_assignment": access.ResourcePermissionAssignment().ToResource(),
152152
"databricks_permissions": permissions.ResourcePermissions().ToResource(),
153153
"databricks_pipeline": pipelines.ResourcePipeline().ToResource(),
154-
"databricks_provider": catalog.ResourceProvider().ToResource(),
154+
"databricks_provider": sharing.ResourceProvider().ToResource(),
155155
"databricks_recipient": sharing.ResourceRecipient().ToResource(),
156156
"databricks_registered_model": catalog.ResourceRegisteredModel().ToResource(),
157157
"databricks_repo": repos.ResourceRepo().ToResource(),
@@ -162,7 +162,7 @@ func DatabricksProvider() *schema.Provider {
162162
"databricks_service_principal": scim.ResourceServicePrincipal().ToResource(),
163163
"databricks_service_principal_role": aws.ResourceServicePrincipalRole().ToResource(),
164164
"databricks_service_principal_secret": tokens.ResourceServicePrincipalSecret().ToResource(),
165-
"databricks_share": catalog.ResourceShare().ToResource(),
165+
"databricks_share": sharing.ResourceShare().ToResource(),
166166
"databricks_sql_dashboard": sql.ResourceSqlDashboard().ToResource(),
167167
"databricks_sql_endpoint": sql.ResourceSqlEndpoint().ToResource(),
168168
"databricks_sql_global_config": sql.ResourceSqlGlobalConfig().ToResource(),

catalog/data_share.go renamed to sharing/data_share.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package catalog
1+
package sharing
22

33
import (
44
"context"

catalog/data_share_test.go renamed to sharing/data_share_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package catalog
1+
package sharing
22

33
import (
44
"testing"

0 commit comments

Comments
 (0)