1. Packages
  2. Databricks
  3. API Docs
  4. getMetastore
Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi

databricks.getMetastore

Explore with Pulumi AI

databricks logo
Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi

    Note This data source can only be used with an account-level provider!

    Retrieves information about metastore for a given id of databricks.Metastore object, that was created by Pulumi or manually, so that special handling could be applied.

    Note If you have a fully automated setup with workspaces created by databricks.MwsWorkspaces or azurerm_databricks_workspace, please make sure to add depends_on attribute in order to prevent authentication is not configured for provider errors.

    Example Usage

    MetastoreInfo response for a given metastore id

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as databricks from "@pulumi/databricks";
    
    const metastore = new aws.s3.BucketV2("metastore", {
        bucket: `${prefix}-metastore`,
        forceDestroy: true,
    });
    const thisMetastore = new databricks.Metastore("this", {
        name: "primary",
        storageRoot: pulumi.interpolate`s3://${metastore.id}/metastore`,
        owner: unityAdminGroup,
        forceDestroy: true,
    });
    const this = databricks.getMetastoreOutput({
        metastoreId: thisMetastore.id,
    });
    export const someMetastore = _this.apply(_this => _this.metastoreInfo);
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_databricks as databricks
    
    metastore = aws.s3.BucketV2("metastore",
        bucket=f"{prefix}-metastore",
        force_destroy=True)
    this_metastore = databricks.Metastore("this",
        name="primary",
        storage_root=metastore.id.apply(lambda id: f"s3://{id}/metastore"),
        owner=unity_admin_group,
        force_destroy=True)
    this = databricks.get_metastore_output(metastore_id=this_metastore.id)
    pulumi.export("someMetastore", this.metastore_info)
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		metastore, err := s3.NewBucketV2(ctx, "metastore", &s3.BucketV2Args{
    			Bucket:       pulumi.Sprintf("%v-metastore", prefix),
    			ForceDestroy: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		thisMetastore, err := databricks.NewMetastore(ctx, "this", &databricks.MetastoreArgs{
    			Name: pulumi.String("primary"),
    			StorageRoot: metastore.ID().ApplyT(func(id string) (string, error) {
    				return fmt.Sprintf("s3://%v/metastore", id), nil
    			}).(pulumi.StringOutput),
    			Owner:        pulumi.Any(unityAdminGroup),
    			ForceDestroy: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		this := databricks.LookupMetastoreOutput(ctx, databricks.GetMetastoreOutputArgs{
    			MetastoreId: thisMetastore.ID(),
    		}, nil)
    		ctx.Export("someMetastore", this.ApplyT(func(this databricks.GetMetastoreResult) (databricks.GetMetastoreMetastoreInfo, error) {
    			return this.MetastoreInfo, nil
    		}).(databricks.GetMetastoreMetastoreInfoOutput))
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Databricks = Pulumi.Databricks;
    
    return await Deployment.RunAsync(() => 
    {
        var metastore = new Aws.S3.BucketV2("metastore", new()
        {
            Bucket = $"{prefix}-metastore",
            ForceDestroy = true,
        });
    
        var thisMetastore = new Databricks.Metastore("this", new()
        {
            Name = "primary",
            StorageRoot = metastore.Id.Apply(id => $"s3://{id}/metastore"),
            Owner = unityAdminGroup,
            ForceDestroy = true,
        });
    
        var @this = Databricks.GetMetastore.Invoke(new()
        {
            MetastoreId = thisMetastore.Id,
        });
    
        return new Dictionary<string, object?>
        {
            ["someMetastore"] = @this.Apply(@this => @this.Apply(getMetastoreResult => getMetastoreResult.MetastoreInfo)),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.s3.BucketV2;
    import com.pulumi.aws.s3.BucketV2Args;
    import com.pulumi.databricks.Metastore;
    import com.pulumi.databricks.MetastoreArgs;
    import com.pulumi.databricks.DatabricksFunctions;
    import com.pulumi.databricks.inputs.GetMetastoreArgs;
    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 metastore = new BucketV2("metastore", BucketV2Args.builder()
                .bucket(String.format("%s-metastore", prefix))
                .forceDestroy(true)
                .build());
    
            var thisMetastore = new Metastore("thisMetastore", MetastoreArgs.builder()
                .name("primary")
                .storageRoot(metastore.id().applyValue(id -> String.format("s3://%s/metastore", id)))
                .owner(unityAdminGroup)
                .forceDestroy(true)
                .build());
    
            final var this = DatabricksFunctions.getMetastore(GetMetastoreArgs.builder()
                .metastoreId(thisMetastore.id())
                .build());
    
            ctx.export("someMetastore", this_.applyValue(this_ -> this_.metastoreInfo()));
        }
    }
    
    resources:
      metastore:
        type: aws:s3:BucketV2
        properties:
          bucket: ${prefix}-metastore
          forceDestroy: true
      thisMetastore:
        type: databricks:Metastore
        name: this
        properties:
          name: primary
          storageRoot: s3://${metastore.id}/metastore
          owner: ${unityAdminGroup}
          forceDestroy: true
    variables:
      this:
        fn::invoke:
          Function: databricks:getMetastore
          Arguments:
            metastoreId: ${thisMetastore.id}
    outputs:
      someMetastore: ${this.metastoreInfo}
    

    The following resources are used in the same context:

    • databricks.getMetastores to get mapping of name to id of all metastores.
    • databricks.Metastore to manage Metastores within Unity Catalog.
    • databricks.Catalog to manage catalogs within Unity Catalog.

    Using getMetastore

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getMetastore(args: GetMetastoreArgs, opts?: InvokeOptions): Promise<GetMetastoreResult>
    function getMetastoreOutput(args: GetMetastoreOutputArgs, opts?: InvokeOptions): Output<GetMetastoreResult>
    def get_metastore(id: Optional[str] = None,
                      metastore_id: Optional[str] = None,
                      metastore_info: Optional[GetMetastoreMetastoreInfo] = None,
                      name: Optional[str] = None,
                      region: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetMetastoreResult
    def get_metastore_output(id: Optional[pulumi.Input[str]] = None,
                      metastore_id: Optional[pulumi.Input[str]] = None,
                      metastore_info: Optional[pulumi.Input[GetMetastoreMetastoreInfoArgs]] = None,
                      name: Optional[pulumi.Input[str]] = None,
                      region: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetMetastoreResult]
    func LookupMetastore(ctx *Context, args *LookupMetastoreArgs, opts ...InvokeOption) (*LookupMetastoreResult, error)
    func LookupMetastoreOutput(ctx *Context, args *LookupMetastoreOutputArgs, opts ...InvokeOption) LookupMetastoreResultOutput

    > Note: This function is named LookupMetastore in the Go SDK.

    public static class GetMetastore 
    {
        public static Task<GetMetastoreResult> InvokeAsync(GetMetastoreArgs args, InvokeOptions? opts = null)
        public static Output<GetMetastoreResult> Invoke(GetMetastoreInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetMetastoreResult> getMetastore(GetMetastoreArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: databricks:index/getMetastore:getMetastore
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    ID of the metastore
    MetastoreId string
    ID of the metastore
    MetastoreInfo GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    Name string
    Name of the metastore
    Region string
    Region of the metastore
    Id string
    ID of the metastore
    MetastoreId string
    ID of the metastore
    MetastoreInfo GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    Name string
    Name of the metastore
    Region string
    Region of the metastore
    id String
    ID of the metastore
    metastoreId String
    ID of the metastore
    metastoreInfo GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    name String
    Name of the metastore
    region String
    Region of the metastore
    id string
    ID of the metastore
    metastoreId string
    ID of the metastore
    metastoreInfo GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    name string
    Name of the metastore
    region string
    Region of the metastore
    id str
    ID of the metastore
    metastore_id str
    ID of the metastore
    metastore_info GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    name str
    Name of the metastore
    region str
    Region of the metastore
    id String
    ID of the metastore
    metastoreId String
    ID of the metastore
    metastoreInfo Property Map
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    name String
    Name of the metastore
    region String
    Region of the metastore

    getMetastore Result

    The following output properties are available:

    Id string
    ID of the metastore
    MetastoreId string
    MetastoreInfo GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    Name string
    Name of metastore.
    Region string
    Id string
    ID of the metastore
    MetastoreId string
    MetastoreInfo GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    Name string
    Name of metastore.
    Region string
    id String
    ID of the metastore
    metastoreId String
    metastoreInfo GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    name String
    Name of metastore.
    region String
    id string
    ID of the metastore
    metastoreId string
    metastoreInfo GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    name string
    Name of metastore.
    region string
    id str
    ID of the metastore
    metastore_id str
    metastore_info GetMetastoreMetastoreInfo
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    name str
    Name of metastore.
    region str
    id String
    ID of the metastore
    metastoreId String
    metastoreInfo Property Map
    MetastoreInfo object for a databricks_metastore. This contains the following attributes:
    name String
    Name of metastore.
    region String

    Supporting Types

    GetMetastoreMetastoreInfo

    Cloud string
    CreatedAt int
    CreatedBy string
    DefaultDataAccessConfigId string
    DeltaSharingOrganizationName string
    The organization name of a Delta Sharing entity. This field is used for Databricks to Databricks sharing.
    DeltaSharingRecipientTokenLifetimeInSeconds int
    Used to set expiration duration in seconds on recipient data access tokens.
    DeltaSharingScope string
    Used to enable delta sharing on the metastore. Valid values: INTERNAL, INTERNAL_AND_EXTERNAL. INTERNAL only allows sharing within the same account, and INTERNAL_AND_EXTERNAL allows cross account sharing and token based sharing.
    ExternalAccessEnabled bool
    GlobalMetastoreId string
    MetastoreId string
    ID of the metastore
    Name string
    Name of the metastore
    Owner string
    Username/groupname/sp application_id of the metastore owner.
    PrivilegeModelVersion string
    Region string
    Region of the metastore
    StorageRoot string
    Path on cloud storage account, where managed databricks.Table are stored.
    StorageRootCredentialId string
    StorageRootCredentialName string
    UpdatedAt int
    UpdatedBy string
    Cloud string
    CreatedAt int
    CreatedBy string
    DefaultDataAccessConfigId string
    DeltaSharingOrganizationName string
    The organization name of a Delta Sharing entity. This field is used for Databricks to Databricks sharing.
    DeltaSharingRecipientTokenLifetimeInSeconds int
    Used to set expiration duration in seconds on recipient data access tokens.
    DeltaSharingScope string
    Used to enable delta sharing on the metastore. Valid values: INTERNAL, INTERNAL_AND_EXTERNAL. INTERNAL only allows sharing within the same account, and INTERNAL_AND_EXTERNAL allows cross account sharing and token based sharing.
    ExternalAccessEnabled bool
    GlobalMetastoreId string
    MetastoreId string
    ID of the metastore
    Name string
    Name of the metastore
    Owner string
    Username/groupname/sp application_id of the metastore owner.
    PrivilegeModelVersion string
    Region string
    Region of the metastore
    StorageRoot string
    Path on cloud storage account, where managed databricks.Table are stored.
    StorageRootCredentialId string
    StorageRootCredentialName string
    UpdatedAt int
    UpdatedBy string
    cloud String
    createdAt Integer
    createdBy String
    defaultDataAccessConfigId String
    deltaSharingOrganizationName String
    The organization name of a Delta Sharing entity. This field is used for Databricks to Databricks sharing.
    deltaSharingRecipientTokenLifetimeInSeconds Integer
    Used to set expiration duration in seconds on recipient data access tokens.
    deltaSharingScope String
    Used to enable delta sharing on the metastore. Valid values: INTERNAL, INTERNAL_AND_EXTERNAL. INTERNAL only allows sharing within the same account, and INTERNAL_AND_EXTERNAL allows cross account sharing and token based sharing.
    externalAccessEnabled Boolean
    globalMetastoreId String
    metastoreId String
    ID of the metastore
    name String
    Name of the metastore
    owner String
    Username/groupname/sp application_id of the metastore owner.
    privilegeModelVersion String
    region String
    Region of the metastore
    storageRoot String
    Path on cloud storage account, where managed databricks.Table are stored.
    storageRootCredentialId String
    storageRootCredentialName String
    updatedAt Integer
    updatedBy String
    cloud string
    createdAt number
    createdBy string
    defaultDataAccessConfigId string
    deltaSharingOrganizationName string
    The organization name of a Delta Sharing entity. This field is used for Databricks to Databricks sharing.
    deltaSharingRecipientTokenLifetimeInSeconds number
    Used to set expiration duration in seconds on recipient data access tokens.
    deltaSharingScope string
    Used to enable delta sharing on the metastore. Valid values: INTERNAL, INTERNAL_AND_EXTERNAL. INTERNAL only allows sharing within the same account, and INTERNAL_AND_EXTERNAL allows cross account sharing and token based sharing.
    externalAccessEnabled boolean
    globalMetastoreId string
    metastoreId string
    ID of the metastore
    name string
    Name of the metastore
    owner string
    Username/groupname/sp application_id of the metastore owner.
    privilegeModelVersion string
    region string
    Region of the metastore
    storageRoot string
    Path on cloud storage account, where managed databricks.Table are stored.
    storageRootCredentialId string
    storageRootCredentialName string
    updatedAt number
    updatedBy string
    cloud str
    created_at int
    created_by str
    default_data_access_config_id str
    delta_sharing_organization_name str
    The organization name of a Delta Sharing entity. This field is used for Databricks to Databricks sharing.
    delta_sharing_recipient_token_lifetime_in_seconds int
    Used to set expiration duration in seconds on recipient data access tokens.
    delta_sharing_scope str
    Used to enable delta sharing on the metastore. Valid values: INTERNAL, INTERNAL_AND_EXTERNAL. INTERNAL only allows sharing within the same account, and INTERNAL_AND_EXTERNAL allows cross account sharing and token based sharing.
    external_access_enabled bool
    global_metastore_id str
    metastore_id str
    ID of the metastore
    name str
    Name of the metastore
    owner str
    Username/groupname/sp application_id of the metastore owner.
    privilege_model_version str
    region str
    Region of the metastore
    storage_root str
    Path on cloud storage account, where managed databricks.Table are stored.
    storage_root_credential_id str
    storage_root_credential_name str
    updated_at int
    updated_by str
    cloud String
    createdAt Number
    createdBy String
    defaultDataAccessConfigId String
    deltaSharingOrganizationName String
    The organization name of a Delta Sharing entity. This field is used for Databricks to Databricks sharing.
    deltaSharingRecipientTokenLifetimeInSeconds Number
    Used to set expiration duration in seconds on recipient data access tokens.
    deltaSharingScope String
    Used to enable delta sharing on the metastore. Valid values: INTERNAL, INTERNAL_AND_EXTERNAL. INTERNAL only allows sharing within the same account, and INTERNAL_AND_EXTERNAL allows cross account sharing and token based sharing.
    externalAccessEnabled Boolean
    globalMetastoreId String
    metastoreId String
    ID of the metastore
    name String
    Name of the metastore
    owner String
    Username/groupname/sp application_id of the metastore owner.
    privilegeModelVersion String
    region String
    Region of the metastore
    storageRoot String
    Path on cloud storage account, where managed databricks.Table are stored.
    storageRootCredentialId String
    storageRootCredentialName String
    updatedAt Number
    updatedBy String

    Package Details

    Repository
    databricks pulumi/pulumi-databricks
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the databricks Terraform Provider.
    databricks logo
    Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi