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

databricks.getTable

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 a workspace-level provider!

    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 default auth: cannot configure default credentials errors.

    Retrieves details of a specific table in Unity Catalog, that were created by Pulumi or manually. Use databricks.getTables to retrieve multiple tables in Unity Catalog

    Example Usage

    Read on a specific table main.certified.fct_transactions:

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const fctTransactions = databricks.getTable({
        name: "main.certified.fct_transactions",
    });
    const things = new databricks.Grants("things", {
        table: fctTransactions.then(fctTransactions => fctTransactions.name),
        grants: [{
            principal: "sensitive",
            privileges: [
                "SELECT",
                "MODIFY",
            ],
        }],
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    fct_transactions = databricks.get_table(name="main.certified.fct_transactions")
    things = databricks.Grants("things",
        table=fct_transactions.name,
        grants=[{
            "principal": "sensitive",
            "privileges": [
                "SELECT",
                "MODIFY",
            ],
        }])
    
    package main
    
    import (
    	"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 {
    		fctTransactions, err := databricks.LookupTable(ctx, &databricks.LookupTableArgs{
    			Name: "main.certified.fct_transactions",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = databricks.NewGrants(ctx, "things", &databricks.GrantsArgs{
    			Table: pulumi.String(fctTransactions.Name),
    			Grants: databricks.GrantsGrantArray{
    				&databricks.GrantsGrantArgs{
    					Principal: pulumi.String("sensitive"),
    					Privileges: pulumi.StringArray{
    						pulumi.String("SELECT"),
    						pulumi.String("MODIFY"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Databricks = Pulumi.Databricks;
    
    return await Deployment.RunAsync(() => 
    {
        var fctTransactions = Databricks.GetTable.Invoke(new()
        {
            Name = "main.certified.fct_transactions",
        });
    
        var things = new Databricks.Grants("things", new()
        {
            Table = fctTransactions.Apply(getTableResult => getTableResult.Name),
            GrantDetails = new[]
            {
                new Databricks.Inputs.GrantsGrantArgs
                {
                    Principal = "sensitive",
                    Privileges = new[]
                    {
                        "SELECT",
                        "MODIFY",
                    },
                },
            },
        });
    
    });
    
    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.GetTableArgs;
    import com.pulumi.databricks.Grants;
    import com.pulumi.databricks.GrantsArgs;
    import com.pulumi.databricks.inputs.GrantsGrantArgs;
    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 fctTransactions = DatabricksFunctions.getTable(GetTableArgs.builder()
                .name("main.certified.fct_transactions")
                .build());
    
            var things = new Grants("things", GrantsArgs.builder()
                .table(fctTransactions.applyValue(getTableResult -> getTableResult.name()))
                .grants(GrantsGrantArgs.builder()
                    .principal("sensitive")
                    .privileges(                
                        "SELECT",
                        "MODIFY")
                    .build())
                .build());
    
        }
    }
    
    resources:
      things:
        type: databricks:Grants
        properties:
          table: ${fctTransactions.name}
          grants:
            - principal: sensitive
              privileges:
                - SELECT
                - MODIFY
    variables:
      fctTransactions:
        fn::invoke:
          Function: databricks:getTable
          Arguments:
            name: main.certified.fct_transactions
    

    The following resources are used in the same context:

    • databricks.Grant to manage grants within Unity Catalog.
    • databricks.getTables to list all tables within a schema in Unity Catalog.

    Using getTable

    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 getTable(args: GetTableArgs, opts?: InvokeOptions): Promise<GetTableResult>
    function getTableOutput(args: GetTableOutputArgs, opts?: InvokeOptions): Output<GetTableResult>
    def get_table(id: Optional[str] = None,
                  name: Optional[str] = None,
                  table_info: Optional[GetTableTableInfo] = None,
                  opts: Optional[InvokeOptions] = None) -> GetTableResult
    def get_table_output(id: Optional[pulumi.Input[str]] = None,
                  name: Optional[pulumi.Input[str]] = None,
                  table_info: Optional[pulumi.Input[GetTableTableInfoArgs]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetTableResult]
    func LookupTable(ctx *Context, args *LookupTableArgs, opts ...InvokeOption) (*LookupTableResult, error)
    func LookupTableOutput(ctx *Context, args *LookupTableOutputArgs, opts ...InvokeOption) LookupTableResultOutput

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

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

    The following arguments are supported:

    Name string
    Full name of the databricks_table: catalog.schema.table
    Id string
    TableInfo GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    Name string
    Full name of the databricks_table: catalog.schema.table
    Id string
    TableInfo GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    name String
    Full name of the databricks_table: catalog.schema.table
    id String
    tableInfo GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    name string
    Full name of the databricks_table: catalog.schema.table
    id string
    tableInfo GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    name str
    Full name of the databricks_table: catalog.schema.table
    id str
    table_info GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    name String
    Full name of the databricks_table: catalog.schema.table
    id String
    tableInfo Property Map
    TableInfo object for a Unity Catalog table. This contains the following attributes:

    getTable Result

    The following output properties are available:

    Id string
    Name string
    Name of table, relative to parent schema.
    TableInfo GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    Id string
    Name string
    Name of table, relative to parent schema.
    TableInfo GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    id String
    name String
    Name of table, relative to parent schema.
    tableInfo GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    id string
    name string
    Name of table, relative to parent schema.
    tableInfo GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    id str
    name str
    Name of table, relative to parent schema.
    table_info GetTableTableInfo
    TableInfo object for a Unity Catalog table. This contains the following attributes:
    id String
    name String
    Name of table, relative to parent schema.
    tableInfo Property Map
    TableInfo object for a Unity Catalog table. This contains the following attributes:

    Supporting Types

    GetTableTableInfo

    AccessPoint string
    BrowseOnly bool
    CatalogName string
    Name of parent catalog.
    Columns List<GetTableTableInfoColumn>
    Array of ColumnInfo objects of the table's columns
    Comment string
    Free-form text description
    CreatedAt int
    CreatedBy string
    DataAccessConfigurationId string
    DataSourceFormat string
    Table format, e.g. DELTA, CSV, JSON
    DeletedAt int
    DeltaRuntimePropertiesKvpairs GetTableTableInfoDeltaRuntimePropertiesKvpairs
    EffectivePredictiveOptimizationFlag GetTableTableInfoEffectivePredictiveOptimizationFlag
    EnablePredictiveOptimization string
    EncryptionDetails GetTableTableInfoEncryptionDetails
    FullName string
    MetastoreId string
    Name string
    Full name of the databricks_table: catalog.schema.table
    Owner string
    Current owner of the table
    PipelineId string
    Properties Dictionary<string, string>
    RowFilter GetTableTableInfoRowFilter
    SchemaName string
    Name of parent schema relative to its parent catalog.
    SqlPath string
    StorageCredentialName string
    StorageLocation string
    TableConstraints List<GetTableTableInfoTableConstraint>
    TableId string
    TableType string
    Table type, e.g. MANAGED, EXTERNAL, VIEW
    UpdatedAt int
    UpdatedBy string
    ViewDefinition string
    View definition SQL (when table_type is VIEW, MATERIALIZED_VIEW, or STREAMING_TABLE)
    ViewDependencies GetTableTableInfoViewDependencies
    View dependencies (when table_type is VIEW or MATERIALIZED_VIEW, STREAMING_TABLE)
    AccessPoint string
    BrowseOnly bool
    CatalogName string
    Name of parent catalog.
    Columns []GetTableTableInfoColumn
    Array of ColumnInfo objects of the table's columns
    Comment string
    Free-form text description
    CreatedAt int
    CreatedBy string
    DataAccessConfigurationId string
    DataSourceFormat string
    Table format, e.g. DELTA, CSV, JSON
    DeletedAt int
    DeltaRuntimePropertiesKvpairs GetTableTableInfoDeltaRuntimePropertiesKvpairs
    EffectivePredictiveOptimizationFlag GetTableTableInfoEffectivePredictiveOptimizationFlag
    EnablePredictiveOptimization string
    EncryptionDetails GetTableTableInfoEncryptionDetails
    FullName string
    MetastoreId string
    Name string
    Full name of the databricks_table: catalog.schema.table
    Owner string
    Current owner of the table
    PipelineId string
    Properties map[string]string
    RowFilter GetTableTableInfoRowFilter
    SchemaName string
    Name of parent schema relative to its parent catalog.
    SqlPath string
    StorageCredentialName string
    StorageLocation string
    TableConstraints []GetTableTableInfoTableConstraint
    TableId string
    TableType string
    Table type, e.g. MANAGED, EXTERNAL, VIEW
    UpdatedAt int
    UpdatedBy string
    ViewDefinition string
    View definition SQL (when table_type is VIEW, MATERIALIZED_VIEW, or STREAMING_TABLE)
    ViewDependencies GetTableTableInfoViewDependencies
    View dependencies (when table_type is VIEW or MATERIALIZED_VIEW, STREAMING_TABLE)
    accessPoint String
    browseOnly Boolean
    catalogName String
    Name of parent catalog.
    columns List<GetTableTableInfoColumn>
    Array of ColumnInfo objects of the table's columns
    comment String
    Free-form text description
    createdAt Integer
    createdBy String
    dataAccessConfigurationId String
    dataSourceFormat String
    Table format, e.g. DELTA, CSV, JSON
    deletedAt Integer
    deltaRuntimePropertiesKvpairs GetTableTableInfoDeltaRuntimePropertiesKvpairs
    effectivePredictiveOptimizationFlag GetTableTableInfoEffectivePredictiveOptimizationFlag
    enablePredictiveOptimization String
    encryptionDetails GetTableTableInfoEncryptionDetails
    fullName String
    metastoreId String
    name String
    Full name of the databricks_table: catalog.schema.table
    owner String
    Current owner of the table
    pipelineId String
    properties Map<String,String>
    rowFilter GetTableTableInfoRowFilter
    schemaName String
    Name of parent schema relative to its parent catalog.
    sqlPath String
    storageCredentialName String
    storageLocation String
    tableConstraints List<GetTableTableInfoTableConstraint>
    tableId String
    tableType String
    Table type, e.g. MANAGED, EXTERNAL, VIEW
    updatedAt Integer
    updatedBy String
    viewDefinition String
    View definition SQL (when table_type is VIEW, MATERIALIZED_VIEW, or STREAMING_TABLE)
    viewDependencies GetTableTableInfoViewDependencies
    View dependencies (when table_type is VIEW or MATERIALIZED_VIEW, STREAMING_TABLE)
    accessPoint string
    browseOnly boolean
    catalogName string
    Name of parent catalog.
    columns GetTableTableInfoColumn[]
    Array of ColumnInfo objects of the table's columns
    comment string
    Free-form text description
    createdAt number
    createdBy string
    dataAccessConfigurationId string
    dataSourceFormat string
    Table format, e.g. DELTA, CSV, JSON
    deletedAt number
    deltaRuntimePropertiesKvpairs GetTableTableInfoDeltaRuntimePropertiesKvpairs
    effectivePredictiveOptimizationFlag GetTableTableInfoEffectivePredictiveOptimizationFlag
    enablePredictiveOptimization string
    encryptionDetails GetTableTableInfoEncryptionDetails
    fullName string
    metastoreId string
    name string
    Full name of the databricks_table: catalog.schema.table
    owner string
    Current owner of the table
    pipelineId string
    properties {[key: string]: string}
    rowFilter GetTableTableInfoRowFilter
    schemaName string
    Name of parent schema relative to its parent catalog.
    sqlPath string
    storageCredentialName string
    storageLocation string
    tableConstraints GetTableTableInfoTableConstraint[]
    tableId string
    tableType string
    Table type, e.g. MANAGED, EXTERNAL, VIEW
    updatedAt number
    updatedBy string
    viewDefinition string
    View definition SQL (when table_type is VIEW, MATERIALIZED_VIEW, or STREAMING_TABLE)
    viewDependencies GetTableTableInfoViewDependencies
    View dependencies (when table_type is VIEW or MATERIALIZED_VIEW, STREAMING_TABLE)
    access_point str
    browse_only bool
    catalog_name str
    Name of parent catalog.
    columns Sequence[GetTableTableInfoColumn]
    Array of ColumnInfo objects of the table's columns
    comment str
    Free-form text description
    created_at int
    created_by str
    data_access_configuration_id str
    data_source_format str
    Table format, e.g. DELTA, CSV, JSON
    deleted_at int
    delta_runtime_properties_kvpairs GetTableTableInfoDeltaRuntimePropertiesKvpairs
    effective_predictive_optimization_flag GetTableTableInfoEffectivePredictiveOptimizationFlag
    enable_predictive_optimization str
    encryption_details GetTableTableInfoEncryptionDetails
    full_name str
    metastore_id str
    name str
    Full name of the databricks_table: catalog.schema.table
    owner str
    Current owner of the table
    pipeline_id str
    properties Mapping[str, str]
    row_filter GetTableTableInfoRowFilter
    schema_name str
    Name of parent schema relative to its parent catalog.
    sql_path str
    storage_credential_name str
    storage_location str
    table_constraints Sequence[GetTableTableInfoTableConstraint]
    table_id str
    table_type str
    Table type, e.g. MANAGED, EXTERNAL, VIEW
    updated_at int
    updated_by str
    view_definition str
    View definition SQL (when table_type is VIEW, MATERIALIZED_VIEW, or STREAMING_TABLE)
    view_dependencies GetTableTableInfoViewDependencies
    View dependencies (when table_type is VIEW or MATERIALIZED_VIEW, STREAMING_TABLE)
    accessPoint String
    browseOnly Boolean
    catalogName String
    Name of parent catalog.
    columns List<Property Map>
    Array of ColumnInfo objects of the table's columns
    comment String
    Free-form text description
    createdAt Number
    createdBy String
    dataAccessConfigurationId String
    dataSourceFormat String
    Table format, e.g. DELTA, CSV, JSON
    deletedAt Number
    deltaRuntimePropertiesKvpairs Property Map
    effectivePredictiveOptimizationFlag Property Map
    enablePredictiveOptimization String
    encryptionDetails Property Map
    fullName String
    metastoreId String
    name String
    Full name of the databricks_table: catalog.schema.table
    owner String
    Current owner of the table
    pipelineId String
    properties Map<String>
    rowFilter Property Map
    schemaName String
    Name of parent schema relative to its parent catalog.
    sqlPath String
    storageCredentialName String
    storageLocation String
    tableConstraints List<Property Map>
    tableId String
    tableType String
    Table type, e.g. MANAGED, EXTERNAL, VIEW
    updatedAt Number
    updatedBy String
    viewDefinition String
    View definition SQL (when table_type is VIEW, MATERIALIZED_VIEW, or STREAMING_TABLE)
    viewDependencies Property Map
    View dependencies (when table_type is VIEW or MATERIALIZED_VIEW, STREAMING_TABLE)

    GetTableTableInfoColumn

    Comment string
    Free-form text description
    Mask GetTableTableInfoColumnMask
    Name string
    Full name of the databricks_table: catalog.schema.table
    Nullable bool
    PartitionIndex int
    Position int
    TypeIntervalType string
    TypeJson string
    TypeName string
    TypePrecision int
    TypeScale int
    TypeText string
    Comment string
    Free-form text description
    Mask GetTableTableInfoColumnMask
    Name string
    Full name of the databricks_table: catalog.schema.table
    Nullable bool
    PartitionIndex int
    Position int
    TypeIntervalType string
    TypeJson string
    TypeName string
    TypePrecision int
    TypeScale int
    TypeText string
    comment String
    Free-form text description
    mask GetTableTableInfoColumnMask
    name String
    Full name of the databricks_table: catalog.schema.table
    nullable Boolean
    partitionIndex Integer
    position Integer
    typeIntervalType String
    typeJson String
    typeName String
    typePrecision Integer
    typeScale Integer
    typeText String
    comment string
    Free-form text description
    mask GetTableTableInfoColumnMask
    name string
    Full name of the databricks_table: catalog.schema.table
    nullable boolean
    partitionIndex number
    position number
    typeIntervalType string
    typeJson string
    typeName string
    typePrecision number
    typeScale number
    typeText string
    comment str
    Free-form text description
    mask GetTableTableInfoColumnMask
    name str
    Full name of the databricks_table: catalog.schema.table
    nullable bool
    partition_index int
    position int
    type_interval_type str
    type_json str
    type_name str
    type_precision int
    type_scale int
    type_text str
    comment String
    Free-form text description
    mask Property Map
    name String
    Full name of the databricks_table: catalog.schema.table
    nullable Boolean
    partitionIndex Number
    position Number
    typeIntervalType String
    typeJson String
    typeName String
    typePrecision Number
    typeScale Number
    typeText String

    GetTableTableInfoColumnMask

    FunctionName string
    UsingColumnNames List<string>
    functionName String
    usingColumnNames List<String>
    functionName String
    usingColumnNames List<String>

    GetTableTableInfoDeltaRuntimePropertiesKvpairs

    DeltaRuntimeProperties Dictionary<string, string>
    DeltaRuntimeProperties map[string]string
    deltaRuntimeProperties Map<String,String>
    deltaRuntimeProperties {[key: string]: string}
    delta_runtime_properties Mapping[str, str]

    GetTableTableInfoEffectivePredictiveOptimizationFlag

    GetTableTableInfoEncryptionDetails

    GetTableTableInfoEncryptionDetailsSseEncryptionDetails

    Algorithm string
    AwsKmsKeyArn string
    Algorithm string
    AwsKmsKeyArn string
    algorithm String
    awsKmsKeyArn String
    algorithm string
    awsKmsKeyArn string
    algorithm String
    awsKmsKeyArn String

    GetTableTableInfoRowFilter

    FunctionName string
    InputColumnNames List<string>
    functionName String
    inputColumnNames List<String>
    functionName String
    inputColumnNames List<String>

    GetTableTableInfoTableConstraint

    GetTableTableInfoTableConstraintForeignKeyConstraint

    ChildColumns List<string>
    Name string
    Full name of the databricks_table: catalog.schema.table
    ParentColumns List<string>
    ParentTable string
    ChildColumns []string
    Name string
    Full name of the databricks_table: catalog.schema.table
    ParentColumns []string
    ParentTable string
    childColumns List<String>
    name String
    Full name of the databricks_table: catalog.schema.table
    parentColumns List<String>
    parentTable String
    childColumns string[]
    name string
    Full name of the databricks_table: catalog.schema.table
    parentColumns string[]
    parentTable string
    child_columns Sequence[str]
    name str
    Full name of the databricks_table: catalog.schema.table
    parent_columns Sequence[str]
    parent_table str
    childColumns List<String>
    name String
    Full name of the databricks_table: catalog.schema.table
    parentColumns List<String>
    parentTable String

    GetTableTableInfoTableConstraintNamedTableConstraint

    Name string
    Full name of the databricks_table: catalog.schema.table
    Name string
    Full name of the databricks_table: catalog.schema.table
    name String
    Full name of the databricks_table: catalog.schema.table
    name string
    Full name of the databricks_table: catalog.schema.table
    name str
    Full name of the databricks_table: catalog.schema.table
    name String
    Full name of the databricks_table: catalog.schema.table

    GetTableTableInfoTableConstraintPrimaryKeyConstraint

    ChildColumns List<string>
    Name string
    Full name of the databricks_table: catalog.schema.table
    ChildColumns []string
    Name string
    Full name of the databricks_table: catalog.schema.table
    childColumns List<String>
    name String
    Full name of the databricks_table: catalog.schema.table
    childColumns string[]
    name string
    Full name of the databricks_table: catalog.schema.table
    child_columns Sequence[str]
    name str
    Full name of the databricks_table: catalog.schema.table
    childColumns List<String>
    name String
    Full name of the databricks_table: catalog.schema.table

    GetTableTableInfoViewDependencies

    GetTableTableInfoViewDependenciesDependency

    GetTableTableInfoViewDependenciesDependencyFunction

    GetTableTableInfoViewDependenciesDependencyTable

    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