1. Packages
  2. Databricks
  3. API Docs
  4. SqlDashboard
Databricks v1.50.2 published on Tuesday, Sep 24, 2024 by Pulumi

databricks.SqlDashboard

Explore with Pulumi AI

databricks logo
Databricks v1.50.2 published on Tuesday, Sep 24, 2024 by Pulumi

    Note: Please switch to databricks.Dashboard to author new AI/BI dashboards using the latest tooling

    This resource is used to manage Legacy dashboards. To manage SQL resources you must have databricks_sql_access on your databricks.Group or databricks_user.

    Note: documentation for this resource is a work in progress.

    A dashboard may have one or more widgets.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const sharedDir = new databricks.Directory("shared_dir", {path: "/Shared/Dashboards"});
    const d1 = new databricks.SqlDashboard("d1", {
        name: "My Dashboard Name",
        parent: pulumi.interpolate`folders/${sharedDir.objectId}`,
        tags: [
            "some-tag",
            "another-tag",
        ],
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    shared_dir = databricks.Directory("shared_dir", path="/Shared/Dashboards")
    d1 = databricks.SqlDashboard("d1",
        name="My Dashboard Name",
        parent=shared_dir.object_id.apply(lambda object_id: f"folders/{object_id}"),
        tags=[
            "some-tag",
            "another-tag",
        ])
    
    package main
    
    import (
    	"fmt"
    
    	"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 {
    		sharedDir, err := databricks.NewDirectory(ctx, "shared_dir", &databricks.DirectoryArgs{
    			Path: pulumi.String("/Shared/Dashboards"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = databricks.NewSqlDashboard(ctx, "d1", &databricks.SqlDashboardArgs{
    			Name: pulumi.String("My Dashboard Name"),
    			Parent: sharedDir.ObjectId.ApplyT(func(objectId int) (string, error) {
    				return fmt.Sprintf("folders/%v", objectId), nil
    			}).(pulumi.StringOutput),
    			Tags: pulumi.StringArray{
    				pulumi.String("some-tag"),
    				pulumi.String("another-tag"),
    			},
    		})
    		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 sharedDir = new Databricks.Directory("shared_dir", new()
        {
            Path = "/Shared/Dashboards",
        });
    
        var d1 = new Databricks.SqlDashboard("d1", new()
        {
            Name = "My Dashboard Name",
            Parent = sharedDir.ObjectId.Apply(objectId => $"folders/{objectId}"),
            Tags = new[]
            {
                "some-tag",
                "another-tag",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.Directory;
    import com.pulumi.databricks.DirectoryArgs;
    import com.pulumi.databricks.SqlDashboard;
    import com.pulumi.databricks.SqlDashboardArgs;
    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 sharedDir = new Directory("sharedDir", DirectoryArgs.builder()
                .path("/Shared/Dashboards")
                .build());
    
            var d1 = new SqlDashboard("d1", SqlDashboardArgs.builder()
                .name("My Dashboard Name")
                .parent(sharedDir.objectId().applyValue(objectId -> String.format("folders/%s", objectId)))
                .tags(            
                    "some-tag",
                    "another-tag")
                .build());
    
        }
    }
    
    resources:
      sharedDir:
        type: databricks:Directory
        name: shared_dir
        properties:
          path: /Shared/Dashboards
      d1:
        type: databricks:SqlDashboard
        properties:
          name: My Dashboard Name
          parent: folders/${sharedDir.objectId}
          tags:
            - some-tag
            - another-tag
    

    Example permission to share dashboard with all users:

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const d1 = new databricks.Permissions("d1", {
        sqlDashboardId: d1DatabricksSqlDashboard.id,
        accessControls: [{
            groupName: users.displayName,
            permissionLevel: "CAN_RUN",
        }],
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    d1 = databricks.Permissions("d1",
        sql_dashboard_id=d1_databricks_sql_dashboard["id"],
        access_controls=[{
            "group_name": users["displayName"],
            "permission_level": "CAN_RUN",
        }])
    
    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 {
    		_, err := databricks.NewPermissions(ctx, "d1", &databricks.PermissionsArgs{
    			SqlDashboardId: pulumi.Any(d1DatabricksSqlDashboard.Id),
    			AccessControls: databricks.PermissionsAccessControlArray{
    				&databricks.PermissionsAccessControlArgs{
    					GroupName:       pulumi.Any(users.DisplayName),
    					PermissionLevel: pulumi.String("CAN_RUN"),
    				},
    			},
    		})
    		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 d1 = new Databricks.Permissions("d1", new()
        {
            SqlDashboardId = d1DatabricksSqlDashboard.Id,
            AccessControls = new[]
            {
                new Databricks.Inputs.PermissionsAccessControlArgs
                {
                    GroupName = users.DisplayName,
                    PermissionLevel = "CAN_RUN",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.Permissions;
    import com.pulumi.databricks.PermissionsArgs;
    import com.pulumi.databricks.inputs.PermissionsAccessControlArgs;
    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 d1 = new Permissions("d1", PermissionsArgs.builder()
                .sqlDashboardId(d1DatabricksSqlDashboard.id())
                .accessControls(PermissionsAccessControlArgs.builder()
                    .groupName(users.displayName())
                    .permissionLevel("CAN_RUN")
                    .build())
                .build());
    
        }
    }
    
    resources:
      d1:
        type: databricks:Permissions
        properties:
          sqlDashboardId: ${d1DatabricksSqlDashboard.id}
          accessControls:
            - groupName: ${users.displayName}
              permissionLevel: CAN_RUN
    

    The following resources are often used in the same context:

    • End to end workspace management guide.
    • databricks.SqlEndpoint to manage Databricks SQL Endpoints.
    • databricks.SqlGlobalConfig to configure the security policy, databricks_instance_profile, and data access properties for all databricks.SqlEndpoint of workspace.
    • databricks.SqlPermissions to manage data object access control lists in Databricks workspaces for things like tables, views, databases, and more.

    Create SqlDashboard Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SqlDashboard(name: string, args?: SqlDashboardArgs, opts?: CustomResourceOptions);
    @overload
    def SqlDashboard(resource_name: str,
                     args: Optional[SqlDashboardArgs] = None,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def SqlDashboard(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     created_at: Optional[str] = None,
                     dashboard_filters_enabled: Optional[bool] = None,
                     name: Optional[str] = None,
                     parent: Optional[str] = None,
                     run_as_role: Optional[str] = None,
                     tags: Optional[Sequence[str]] = None,
                     updated_at: Optional[str] = None)
    func NewSqlDashboard(ctx *Context, name string, args *SqlDashboardArgs, opts ...ResourceOption) (*SqlDashboard, error)
    public SqlDashboard(string name, SqlDashboardArgs? args = null, CustomResourceOptions? opts = null)
    public SqlDashboard(String name, SqlDashboardArgs args)
    public SqlDashboard(String name, SqlDashboardArgs args, CustomResourceOptions options)
    
    type: databricks:SqlDashboard
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SqlDashboardArgs
    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 SqlDashboardArgs
    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 SqlDashboardArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SqlDashboardArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SqlDashboardArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var sqlDashboardResource = new Databricks.SqlDashboard("sqlDashboardResource", new()
    {
        CreatedAt = "string",
        DashboardFiltersEnabled = false,
        Name = "string",
        Parent = "string",
        RunAsRole = "string",
        Tags = new[]
        {
            "string",
        },
        UpdatedAt = "string",
    });
    
    example, err := databricks.NewSqlDashboard(ctx, "sqlDashboardResource", &databricks.SqlDashboardArgs{
    	CreatedAt:               pulumi.String("string"),
    	DashboardFiltersEnabled: pulumi.Bool(false),
    	Name:                    pulumi.String("string"),
    	Parent:                  pulumi.String("string"),
    	RunAsRole:               pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	UpdatedAt: pulumi.String("string"),
    })
    
    var sqlDashboardResource = new SqlDashboard("sqlDashboardResource", SqlDashboardArgs.builder()
        .createdAt("string")
        .dashboardFiltersEnabled(false)
        .name("string")
        .parent("string")
        .runAsRole("string")
        .tags("string")
        .updatedAt("string")
        .build());
    
    sql_dashboard_resource = databricks.SqlDashboard("sqlDashboardResource",
        created_at="string",
        dashboard_filters_enabled=False,
        name="string",
        parent="string",
        run_as_role="string",
        tags=["string"],
        updated_at="string")
    
    const sqlDashboardResource = new databricks.SqlDashboard("sqlDashboardResource", {
        createdAt: "string",
        dashboardFiltersEnabled: false,
        name: "string",
        parent: "string",
        runAsRole: "string",
        tags: ["string"],
        updatedAt: "string",
    });
    
    type: databricks:SqlDashboard
    properties:
        createdAt: string
        dashboardFiltersEnabled: false
        name: string
        parent: string
        runAsRole: string
        tags:
            - string
        updatedAt: string
    

    SqlDashboard 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 SqlDashboard resource accepts the following input properties:

    CreatedAt string
    DashboardFiltersEnabled bool
    Name string
    Parent string
    RunAsRole string
    Tags List<string>
    UpdatedAt string
    CreatedAt string
    DashboardFiltersEnabled bool
    Name string
    Parent string
    RunAsRole string
    Tags []string
    UpdatedAt string
    createdAt String
    dashboardFiltersEnabled Boolean
    name String
    parent String
    runAsRole String
    tags List<String>
    updatedAt String
    createdAt string
    dashboardFiltersEnabled boolean
    name string
    parent string
    runAsRole string
    tags string[]
    updatedAt string
    createdAt String
    dashboardFiltersEnabled Boolean
    name String
    parent String
    runAsRole String
    tags List<String>
    updatedAt String

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SqlDashboard 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 SqlDashboard Resource

    Get an existing SqlDashboard 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?: SqlDashboardState, opts?: CustomResourceOptions): SqlDashboard
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            dashboard_filters_enabled: Optional[bool] = None,
            name: Optional[str] = None,
            parent: Optional[str] = None,
            run_as_role: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            updated_at: Optional[str] = None) -> SqlDashboard
    func GetSqlDashboard(ctx *Context, name string, id IDInput, state *SqlDashboardState, opts ...ResourceOption) (*SqlDashboard, error)
    public static SqlDashboard Get(string name, Input<string> id, SqlDashboardState? state, CustomResourceOptions? opts = null)
    public static SqlDashboard get(String name, Output<String> id, SqlDashboardState 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 string
    DashboardFiltersEnabled bool
    Name string
    Parent string
    RunAsRole string
    Tags List<string>
    UpdatedAt string
    CreatedAt string
    DashboardFiltersEnabled bool
    Name string
    Parent string
    RunAsRole string
    Tags []string
    UpdatedAt string
    createdAt String
    dashboardFiltersEnabled Boolean
    name String
    parent String
    runAsRole String
    tags List<String>
    updatedAt String
    createdAt string
    dashboardFiltersEnabled boolean
    name string
    parent string
    runAsRole string
    tags string[]
    updatedAt string
    createdAt String
    dashboardFiltersEnabled Boolean
    name String
    parent String
    runAsRole String
    tags List<String>
    updatedAt String

    Import

    You can import a databricks_sql_dashboard resource with ID like the following:

    bash

    $ pulumi import databricks:index/sqlDashboard:SqlDashboard this <dashboard-id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    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.50.2 published on Tuesday, Sep 24, 2024 by Pulumi