databricks logo
Databricks v1.14.0, May 23 23

databricks.SqlWidget

Explore with Pulumi AI

To manage SQLA 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 widget is always tied to a dashboard. Every dashboard may have one or more widgets.

The following resources are often used in the same context:

  • End to end workspace management guide.
  • databricks.SqlDashboard to manage Databricks SQL Dashboards.
  • 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.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;

return await Deployment.RunAsync(() => 
{
    var d1w1 = new Databricks.SqlWidget("d1w1", new()
    {
        DashboardId = databricks_sql_dashboard.D1.Id,
        Text = "Hello! I'm a **text widget**!",
        Position = new Databricks.Inputs.SqlWidgetPositionArgs
        {
            SizeX = 3,
            SizeY = 4,
            PosX = 0,
            PosY = 0,
        },
    });

    var d1w2 = new Databricks.SqlWidget("d1w2", new()
    {
        DashboardId = databricks_sql_dashboard.D1.Id,
        VisualizationId = databricks_sql_visualization.Q1v1.Id,
        Position = new Databricks.Inputs.SqlWidgetPositionArgs
        {
            SizeX = 3,
            SizeY = 4,
            PosX = 3,
            PosY = 0,
        },
    });

});
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.NewSqlWidget(ctx, "d1w1", &databricks.SqlWidgetArgs{
			DashboardId: pulumi.Any(databricks_sql_dashboard.D1.Id),
			Text:        pulumi.String("Hello! I'm a **text widget**!"),
			Position: &databricks.SqlWidgetPositionArgs{
				SizeX: pulumi.Int(3),
				SizeY: pulumi.Int(4),
				PosX:  pulumi.Int(0),
				PosY:  pulumi.Int(0),
			},
		})
		if err != nil {
			return err
		}
		_, err = databricks.NewSqlWidget(ctx, "d1w2", &databricks.SqlWidgetArgs{
			DashboardId:     pulumi.Any(databricks_sql_dashboard.D1.Id),
			VisualizationId: pulumi.Any(databricks_sql_visualization.Q1v1.Id),
			Position: &databricks.SqlWidgetPositionArgs{
				SizeX: pulumi.Int(3),
				SizeY: pulumi.Int(4),
				PosX:  pulumi.Int(3),
				PosY:  pulumi.Int(0),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.SqlWidget;
import com.pulumi.databricks.SqlWidgetArgs;
import com.pulumi.databricks.inputs.SqlWidgetPositionArgs;
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 d1w1 = new SqlWidget("d1w1", SqlWidgetArgs.builder()        
            .dashboardId(databricks_sql_dashboard.d1().id())
            .text("Hello! I'm a **text widget**!")
            .position(SqlWidgetPositionArgs.builder()
                .sizeX(3)
                .sizeY(4)
                .posX(0)
                .posY(0)
                .build())
            .build());

        var d1w2 = new SqlWidget("d1w2", SqlWidgetArgs.builder()        
            .dashboardId(databricks_sql_dashboard.d1().id())
            .visualizationId(databricks_sql_visualization.q1v1().id())
            .position(SqlWidgetPositionArgs.builder()
                .sizeX(3)
                .sizeY(4)
                .posX(3)
                .posY(0)
                .build())
            .build());

    }
}
import pulumi
import pulumi_databricks as databricks

d1w1 = databricks.SqlWidget("d1w1",
    dashboard_id=databricks_sql_dashboard["d1"]["id"],
    text="Hello! I'm a **text widget**!",
    position=databricks.SqlWidgetPositionArgs(
        size_x=3,
        size_y=4,
        pos_x=0,
        pos_y=0,
    ))
d1w2 = databricks.SqlWidget("d1w2",
    dashboard_id=databricks_sql_dashboard["d1"]["id"],
    visualization_id=databricks_sql_visualization["q1v1"]["id"],
    position=databricks.SqlWidgetPositionArgs(
        size_x=3,
        size_y=4,
        pos_x=3,
        pos_y=0,
    ))
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";

const d1w1 = new databricks.SqlWidget("d1w1", {
    dashboardId: databricks_sql_dashboard.d1.id,
    text: "Hello! I'm a **text widget**!",
    position: {
        sizeX: 3,
        sizeY: 4,
        posX: 0,
        posY: 0,
    },
});
const d1w2 = new databricks.SqlWidget("d1w2", {
    dashboardId: databricks_sql_dashboard.d1.id,
    visualizationId: databricks_sql_visualization.q1v1.id,
    position: {
        sizeX: 3,
        sizeY: 4,
        posX: 3,
        posY: 0,
    },
});
resources:
  d1w1:
    type: databricks:SqlWidget
    properties:
      dashboardId: ${databricks_sql_dashboard.d1.id}
      text: Hello! I'm a **text widget**!
      position:
        sizeX: 3
        sizeY: 4
        posX: 0
        posY: 0
  d1w2:
    type: databricks:SqlWidget
    properties:
      dashboardId: ${databricks_sql_dashboard.d1.id}
      visualizationId: ${databricks_sql_visualization.q1v1.id}
      position:
        sizeX: 3
        sizeY: 4
        posX: 3
        posY: 0

Create SqlWidget Resource

new SqlWidget(name: string, args: SqlWidgetArgs, opts?: CustomResourceOptions);
@overload
def SqlWidget(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              dashboard_id: Optional[str] = None,
              description: Optional[str] = None,
              parameters: Optional[Sequence[SqlWidgetParameterArgs]] = None,
              position: Optional[SqlWidgetPositionArgs] = None,
              text: Optional[str] = None,
              title: Optional[str] = None,
              visualization_id: Optional[str] = None,
              widget_id: Optional[str] = None)
@overload
def SqlWidget(resource_name: str,
              args: SqlWidgetArgs,
              opts: Optional[ResourceOptions] = None)
func NewSqlWidget(ctx *Context, name string, args SqlWidgetArgs, opts ...ResourceOption) (*SqlWidget, error)
public SqlWidget(string name, SqlWidgetArgs args, CustomResourceOptions? opts = null)
public SqlWidget(String name, SqlWidgetArgs args)
public SqlWidget(String name, SqlWidgetArgs args, CustomResourceOptions options)
type: databricks:SqlWidget
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

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

Outputs

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

Get an existing SqlWidget 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?: SqlWidgetState, opts?: CustomResourceOptions): SqlWidget
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        dashboard_id: Optional[str] = None,
        description: Optional[str] = None,
        parameters: Optional[Sequence[SqlWidgetParameterArgs]] = None,
        position: Optional[SqlWidgetPositionArgs] = None,
        text: Optional[str] = None,
        title: Optional[str] = None,
        visualization_id: Optional[str] = None,
        widget_id: Optional[str] = None) -> SqlWidget
func GetSqlWidget(ctx *Context, name string, id IDInput, state *SqlWidgetState, opts ...ResourceOption) (*SqlWidget, error)
public static SqlWidget Get(string name, Input<string> id, SqlWidgetState? state, CustomResourceOptions? opts = null)
public static SqlWidget get(String name, Output<String> id, SqlWidgetState 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:

Supporting Types

SqlWidgetParameter

Name string
Type string
MapTo string
Title string
Value string
Values List<string>
Name string
Type string
MapTo string
Title string
Value string
Values []string
name String
type String
mapTo String
title String
value String
values List<String>
name string
type string
mapTo string
title string
value string
values string[]
name str
type str
map_to str
title str
value str
values Sequence[str]
name String
type String
mapTo String
title String
value String
values List<String>

SqlWidgetPosition

SizeX int
SizeY int
AutoHeight bool
PosX int
PosY int
SizeX int
SizeY int
AutoHeight bool
PosX int
PosY int
sizeX Integer
sizeY Integer
autoHeight Boolean
posX Integer
posY Integer
sizeX number
sizeY number
autoHeight boolean
posX number
posY number
sizeX Number
sizeY Number
autoHeight Boolean
posX Number
posY Number

Import

You can import a databricks_sql_widget resource with ID like the followingbash

 $ pulumi import databricks:index/sqlWidget:SqlWidget this <dashboard-id>/<widget-id>

Package Details

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

This Pulumi package is based on the databricks Terraform Provider.