databricks_share Resource

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.

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. If you remove a share from your Unity Catalog metastore, all recipients of that share lose the ability to access it.

Example Usage

Creating a Delta Sharing share and add some existing tables to it

data "databricks_tables" "things" {
  catalog_name = "sandbox"
  schema_name  = "things"
}

resource "databricks_share" "some" {
  name = "my_share"
  dynamic "object" {
    for_each = data.databricks_tables.things.ids
    content {
      name             = object.value
      data_object_type = "TABLE"
    }
  }
}

Creating a Delta Sharing share and add a schema to it(including all current and future tables).

resource "databricks_share" "schema_share" {
  name = "schema_share"
  object {
    name                        = "catalog_name.schema_name"
    data_object_type            = "SCHEMA"
    history_data_sharing_status = "ENABLED"
  }
}

Creating a Delta Sharing share and share a table with partitions spec and history

resource "databricks_share" "some" {
  name = "my_share"
  object {
    name                        = "my_catalog.my_schema.my_table"
    data_object_type            = "TABLE"
    history_data_sharing_status = "ENABLED"
    partition {
      value {
        name  = "year"
        op    = "EQUAL"
        value = "2009"
      }
      value {
        name  = "month"
        op    = "EQUAL"
        value = "12"
      }
    }
    partition {
      value {
        name  = "year"
        op    = "EQUAL"
        value = "2010"
      }
    }
  }
}

Argument Reference

The following arguments are required:

object Configuration Block

To share only part of a table when you add the table to a share, you can provide partition specifications. This is specified by a number of partition blocks. Each entry in partition block takes a list of value blocks. The field is documented below.

value Configuration Block

Attribute Reference

In addition to all arguments above, the following attributes are exported:

The following resources are often used in the same context: