Skip to content

Commit e189a3f

Browse files
authored
Document string_shared_as Field in Share Resource Docs (#5289)
## Summary Updates the `databricks_share` resource documentation to include the previously undocumented `string_shared_as` field and clarify when to use each alias field based on data object type. ## Testing Documentation changes only - no code changes required. NO_CHANGELOG=true Co-authored-by: Omer Lachish <rauchy@users.noreply.github.com>
1 parent 748d779 commit e189a3f

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

docs/resources/share.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,35 @@ resource "databricks_share" "some" {
3333
}
3434
```
3535

36+
Creating a Delta Sharing share with mixed object types (tables and volumes)
37+
38+
```hcl
39+
resource "databricks_share" "mixed" {
40+
name = "mixed_share"
41+
42+
# Table - uses shared_as
43+
object {
44+
name = "my_catalog.my_schema.sales_table"
45+
data_object_type = "TABLE"
46+
shared_as = "my_schema.sales_table"
47+
}
48+
49+
# Materialized View - uses shared_as
50+
object {
51+
name = "my_catalog.my_schema.sales_mv"
52+
data_object_type = "MATERIALIZED_VIEW"
53+
shared_as = "my_schema.sales_mv"
54+
}
55+
56+
# Volume - uses string_shared_as
57+
object {
58+
name = "my_catalog.my_schema.training_data"
59+
data_object_type = "VOLUME"
60+
string_shared_as = "my_schema.training_data"
61+
}
62+
}
63+
```
64+
3665
Creating a Delta Sharing share and add a schema to it(including all current and future tables).
3766

3867
```hcl
@@ -95,7 +124,8 @@ The following arguments are required:
95124
* `comment` - (Optional) Description about the object.
96125
* `content` - (Optional) The content of the notebook file when the data object type is NOTEBOOK_FILE. This should be base64 encoded. Required for adding a NOTEBOOK_FILE, optional for updating, ignored for other types.
97126
* `partition` - (Optional) Array of partitions for the shared data.
98-
* `shared_as` - (Optional) A user-provided new name for the data object within the share. If this new name is not provided, the object's original name will be used as the `shared_as` name. The `shared_as` name must be unique within a Share. Change forces creation of a new resource.
127+
* `shared_as` - (Optional) A user-provided alias name for **table-like data objects** within the share. Use this field for: `TABLE`, `VIEW`, `MATERIALIZED_VIEW`, `STREAMING_TABLE`, `FOREIGN_TABLE`. **Do not use this field for volumes, models, notebooks, or functions** (use `string_shared_as` instead). If not provided, the object's original name will be used. Must be a 2-part name `<schema>.<table>` containing only alphanumeric characters and underscores. The `shared_as` name must be unique within a share. Change forces creation of a new resource.
128+
* `string_shared_as` - (Optional) A user-provided alias name for **non-table data objects** within the share. Use this field for: `VOLUME`, `MODEL`, `NOTEBOOK_FILE`, `FUNCTION`. **Do not use this field for tables, views, or streaming tables** (use `shared_as` instead). Format varies by type: For volumes, models, and functions use `<schema>.<name>` (2-part name); for notebooks use the file name. Names must contain only alphanumeric characters and underscores. The `string_shared_as` name must be unique for objects of the same type within a share. Change forces creation of a new resource.
99129
* `cdf_enabled` - (Optional) Whether to enable Change Data Feed (cdf) on the shared object. When this field is set, field `history_data_sharing_status` can not be set.
100130
* `start_version` - (Optional) The start version associated with the object for cdf. This allows data providers to control the lowest object version that is accessible by clients.
101131
* `history_data_sharing_status` - (Optional) Whether to enable history sharing, one of: `ENABLED`, `DISABLED`. When a table has history sharing enabled, recipients can query table data by version, starting from the current table version. If not specified, clients can only query starting from the version of the object at the time it was added to the share. *NOTE*: The start_version should be less than or equal the current version of the object. When this field is set, field `cdf_enabled` can not be set.

0 commit comments

Comments
 (0)