databricks logo
Databricks v1.14.0, May 23 23

databricks.Share

Explore with Pulumi AI

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.

A databricks.Share is contained within databricks.Metastore and can contain a list of tables.

The following resources are often used in the same context:

  • databricks.Recipient to create Delta Sharing recipients.
  • databricks.Grants to manage Delta Sharing permissions.
  • databricks.getShares to read existing Delta Sharing shares.

Example Usage

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

Coming soon!

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.DatabricksFunctions;
import com.pulumi.databricks.inputs.GetTablesArgs;
import com.pulumi.databricks.Share;
import com.pulumi.databricks.ShareArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var things = DatabricksFunctions.getTables(GetTablesArgs.builder()
            .catalogName("sandbox")
            .schemaName("things")
            .build());

        var some = new Share("some", ShareArgs.builder()        
            .dynamic(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
            .build());

    }
}

Coming soon!

Coming soon!

resources:
  some:
    type: databricks:Share
    properties:
      dynamic:
        - forEach: ${things.ids}
          content:
            - name: ${object.value}
              dataObjectType: TABLE
variables:
  things:
    fn::invoke:
      Function: databricks:getTables
      Arguments:
        catalogName: sandbox
        schemaName: things

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

Coming soon!

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.Share;
import com.pulumi.databricks.ShareArgs;
import com.pulumi.databricks.inputs.ShareObjectArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var some = new Share("some", ShareArgs.builder()        
            .objects(ShareObjectArgs.builder()
                .dataObjectType("TABLE")
                .historyDataSharingStatus("ENABLED")
                .name("my_catalog.my_schema.my_table")
                .partitions(                
                    ShareObjectPartitionArgs.builder()
                        .value(                        
                            %!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
                            %!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
                        .build(),
                    ShareObjectPartitionArgs.builder()
                        .value(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
                        .build())
                .build())
            .build());

    }
}

Coming soon!

Coming soon!

resources:
  some:
    type: databricks:Share
    properties:
      objects:
        - dataObjectType: TABLE
          historyDataSharingStatus: ENABLED
          name: my_catalog.my_schema.my_table
          partitions:
            - value:
                - name: year
                  op: EQUAL
                  value: '2009'
                - name: month
                  op: EQUAL
                  value: '12'
            - value:
                - name: year
                  op: EQUAL
                  value: '2010'

Create Share Resource

new Share(name: string, args?: ShareArgs, opts?: CustomResourceOptions);
@overload
def Share(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          created_at: Optional[int] = None,
          created_by: Optional[str] = None,
          name: Optional[str] = None,
          objects: Optional[Sequence[ShareObjectArgs]] = None)
@overload
def Share(resource_name: str,
          args: Optional[ShareArgs] = None,
          opts: Optional[ResourceOptions] = None)
func NewShare(ctx *Context, name string, args *ShareArgs, opts ...ResourceOption) (*Share, error)
public Share(string name, ShareArgs? args = null, CustomResourceOptions? opts = null)
public Share(String name, ShareArgs args)
public Share(String name, ShareArgs args, CustomResourceOptions options)
type: databricks:Share
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ShareArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ShareArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ShareArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ShareArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ShareArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Share Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Share resource accepts the following input properties:

CreatedAt int

Time when the share was created.

CreatedBy string

The principal that created the share.

Name string

Name of share. Change forces creation of a new resource.

Objects List<ShareObjectArgs>
CreatedAt int

Time when the share was created.

CreatedBy string

The principal that created the share.

Name string

Name of share. Change forces creation of a new resource.

Objects []ShareObjectArgs
createdAt Integer

Time when the share was created.

createdBy String

The principal that created the share.

name String

Name of share. Change forces creation of a new resource.

objects List<ShareObjectArgs>
createdAt number

Time when the share was created.

createdBy string

The principal that created the share.

name string

Name of share. Change forces creation of a new resource.

objects ShareObjectArgs[]
created_at int

Time when the share was created.

created_by str

The principal that created the share.

name str

Name of share. Change forces creation of a new resource.

objects Sequence[ShareObjectArgs]
createdAt Number

Time when the share was created.

createdBy String

The principal that created the share.

name String

Name of share. Change forces creation of a new resource.

objects List<Property Map>

Outputs

All input properties are implicitly available as output properties. Additionally, the Share resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Share Resource

Get an existing Share resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ShareState, opts?: CustomResourceOptions): Share
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        created_at: Optional[int] = None,
        created_by: Optional[str] = None,
        name: Optional[str] = None,
        objects: Optional[Sequence[ShareObjectArgs]] = None) -> Share
func GetShare(ctx *Context, name string, id IDInput, state *ShareState, opts ...ResourceOption) (*Share, error)
public static Share Get(string name, Input<string> id, ShareState? state, CustomResourceOptions? opts = null)
public static Share get(String name, Output<String> id, ShareState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CreatedAt int

Time when the share was created.

CreatedBy string

The principal that created the share.

Name string

Name of share. Change forces creation of a new resource.

Objects List<ShareObjectArgs>
CreatedAt int

Time when the share was created.

CreatedBy string

The principal that created the share.

Name string

Name of share. Change forces creation of a new resource.

Objects []ShareObjectArgs
createdAt Integer

Time when the share was created.

createdBy String

The principal that created the share.

name String

Name of share. Change forces creation of a new resource.

objects List<ShareObjectArgs>
createdAt number

Time when the share was created.

createdBy string

The principal that created the share.

name string

Name of share. Change forces creation of a new resource.

objects ShareObjectArgs[]
created_at int

Time when the share was created.

created_by str

The principal that created the share.

name str

Name of share. Change forces creation of a new resource.

objects Sequence[ShareObjectArgs]
createdAt Number

Time when the share was created.

createdBy String

The principal that created the share.

name String

Name of share. Change forces creation of a new resource.

objects List<Property Map>

Supporting Types

ShareObject

DataObjectType string

Type of the object, currently only TABLE is allowed.

Name string

Full name of the object, e.g. catalog.schema.name for a table.

AddedAt int
AddedBy string
CdfEnabled bool

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.

Comment string

Description about the object.

HistoryDataSharingStatus string

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.

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.

Partitions List<ShareObjectPartition>
SharedAs string

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.

StartVersion int

The start version associated with the object for cdf. This allows data providers to control the lowest object version that is accessible by clients.

Status string

Status of the object, one of: ACTIVE, PERMISSION_DENIED.

DataObjectType string

Type of the object, currently only TABLE is allowed.

Name string

Full name of the object, e.g. catalog.schema.name for a table.

AddedAt int
AddedBy string
CdfEnabled bool

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.

Comment string

Description about the object.

HistoryDataSharingStatus string

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.

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.

Partitions []ShareObjectPartition
SharedAs string

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.

StartVersion int

The start version associated with the object for cdf. This allows data providers to control the lowest object version that is accessible by clients.

Status string

Status of the object, one of: ACTIVE, PERMISSION_DENIED.

dataObjectType String

Type of the object, currently only TABLE is allowed.

name String

Full name of the object, e.g. catalog.schema.name for a table.

addedAt Integer
addedBy String
cdfEnabled Boolean

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.

comment String

Description about the object.

historyDataSharingStatus String

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.

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.

partitions List<ShareObjectPartition>
sharedAs String

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.

startVersion Integer

The start version associated with the object for cdf. This allows data providers to control the lowest object version that is accessible by clients.

status String

Status of the object, one of: ACTIVE, PERMISSION_DENIED.

dataObjectType string

Type of the object, currently only TABLE is allowed.

name string

Full name of the object, e.g. catalog.schema.name for a table.

addedAt number
addedBy string
cdfEnabled boolean

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.

comment string

Description about the object.

historyDataSharingStatus string

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.

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.

partitions ShareObjectPartition[]
sharedAs string

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.

startVersion number

The start version associated with the object for cdf. This allows data providers to control the lowest object version that is accessible by clients.

status string

Status of the object, one of: ACTIVE, PERMISSION_DENIED.

data_object_type str

Type of the object, currently only TABLE is allowed.

name str

Full name of the object, e.g. catalog.schema.name for a table.

added_at int
added_by str
cdf_enabled bool

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.

comment str

Description about the object.

history_data_sharing_status str

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.

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.

partitions Sequence[ShareObjectPartition]
shared_as str

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.

start_version int

The start version associated with the object for cdf. This allows data providers to control the lowest object version that is accessible by clients.

status str

Status of the object, one of: ACTIVE, PERMISSION_DENIED.

dataObjectType String

Type of the object, currently only TABLE is allowed.

name String

Full name of the object, e.g. catalog.schema.name for a table.

addedAt Number
addedBy String
cdfEnabled Boolean

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.

comment String

Description about the object.

historyDataSharingStatus String

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.

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.

partitions List<Property Map>
sharedAs String

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.

startVersion Number

The start version associated with the object for cdf. This allows data providers to control the lowest object version that is accessible by clients.

status String

Status of the object, one of: ACTIVE, PERMISSION_DENIED.

ShareObjectPartition

ShareObjectPartitionValue

Name string

The name of the partition column.

Op string

The operator to apply for the value, one of: EQUAL, LIKE

RecipientPropertyKey string

The key of a Delta Sharing recipient's property. For example databricks-account-id. When this field is set, field value can not be set.

Value string

The value of the partition column. When this value is not set, it means null value. When this field is set, field recipient_property_key can not be set.

Name string

The name of the partition column.

Op string

The operator to apply for the value, one of: EQUAL, LIKE

RecipientPropertyKey string

The key of a Delta Sharing recipient's property. For example databricks-account-id. When this field is set, field value can not be set.

Value string

The value of the partition column. When this value is not set, it means null value. When this field is set, field recipient_property_key can not be set.

name String

The name of the partition column.

op String

The operator to apply for the value, one of: EQUAL, LIKE

recipientPropertyKey String

The key of a Delta Sharing recipient's property. For example databricks-account-id. When this field is set, field value can not be set.

value String

The value of the partition column. When this value is not set, it means null value. When this field is set, field recipient_property_key can not be set.

name string

The name of the partition column.

op string

The operator to apply for the value, one of: EQUAL, LIKE

recipientPropertyKey string

The key of a Delta Sharing recipient's property. For example databricks-account-id. When this field is set, field value can not be set.

value string

The value of the partition column. When this value is not set, it means null value. When this field is set, field recipient_property_key can not be set.

name str

The name of the partition column.

op str

The operator to apply for the value, one of: EQUAL, LIKE

recipient_property_key str

The key of a Delta Sharing recipient's property. For example databricks-account-id. When this field is set, field value can not be set.

value str

The value of the partition column. When this value is not set, it means null value. When this field is set, field recipient_property_key can not be set.

name String

The name of the partition column.

op String

The operator to apply for the value, one of: EQUAL, LIKE

recipientPropertyKey String

The key of a Delta Sharing recipient's property. For example databricks-account-id. When this field is set, field value can not be set.

value String

The value of the partition column. When this value is not set, it means null value. When this field is set, field recipient_property_key can not be set.

Package Details

Repository
databricks pulumi/pulumi-databricks
License
Apache-2.0
Notes

This Pulumi package is based on the databricks Terraform Provider.