1. Packages
  2. Databricks Provider
  3. API Docs
  4. SqlWidget
Databricks v1.68.0 published on Friday, Apr 25, 2025 by Pulumi

databricks.SqlWidget

Explore with Pulumi AI

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

To manage SQL resources you must have databricks_sql_access on your databricks.Group or databricks_user.

documentation for this resource is a work in progress.

A widget is always tied to a Legacy dashboard. Every dashboard may have one or more widgets.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";

const d1w1 = new databricks.SqlWidget("d1w1", {
    dashboardId: 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: d1.id,
    visualizationId: q1v1.id,
    position: {
        sizeX: 3,
        sizeY: 4,
        posX: 3,
        posY: 0,
    },
});
Copy
import pulumi
import pulumi_databricks as databricks

d1w1 = databricks.SqlWidget("d1w1",
    dashboard_id=d1["id"],
    text="Hello! I'm a **text widget**!",
    position={
        "size_x": 3,
        "size_y": 4,
        "pos_x": 0,
        "pos_y": 0,
    })
d1w2 = databricks.SqlWidget("d1w2",
    dashboard_id=d1["id"],
    visualization_id=q1v1["id"],
    position={
        "size_x": 3,
        "size_y": 4,
        "pos_x": 3,
        "pos_y": 0,
    })
Copy
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(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(d1.Id),
			VisualizationId: pulumi.Any(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
	})
}
Copy
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 = 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 = d1.Id,
        VisualizationId = q1v1.Id,
        Position = new Databricks.Inputs.SqlWidgetPositionArgs
        {
            SizeX = 3,
            SizeY = 4,
            PosX = 3,
            PosY = 0,
        },
    });

});
Copy
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(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(d1.id())
            .visualizationId(q1v1.id())
            .position(SqlWidgetPositionArgs.builder()
                .sizeX(3)
                .sizeY(4)
                .posX(3)
                .posY(0)
                .build())
            .build());

    }
}
Copy
resources:
  d1w1:
    type: databricks:SqlWidget
    properties:
      dashboardId: ${d1.id}
      text: Hello! I'm a **text widget**!
      position:
        sizeX: 3
        sizeY: 4
        posX: 0
        posY: 0
  d1w2:
    type: databricks:SqlWidget
    properties:
      dashboardId: ${d1.id}
      visualizationId: ${q1v1.id}
      position:
        sizeX: 3
        sizeY: 4
        posX: 3
        posY: 0
Copy

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.

Create SqlWidget Resource

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

Constructor syntax

new SqlWidget(name: string, args: SqlWidgetArgs, opts?: CustomResourceOptions);
@overload
def SqlWidget(resource_name: str,
              args: SqlWidgetArgs,
              opts: Optional[ResourceOptions] = None)

@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)
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.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SqlWidgetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. SqlWidgetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SqlWidgetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SqlWidgetArgs
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 sqlWidgetResource = new Databricks.SqlWidget("sqlWidgetResource", new()
{
    DashboardId = "string",
    Description = "string",
    Parameters = new[]
    {
        new Databricks.Inputs.SqlWidgetParameterArgs
        {
            Name = "string",
            Type = "string",
            MapTo = "string",
            Title = "string",
            Value = "string",
            Values = new[]
            {
                "string",
            },
        },
    },
    Position = new Databricks.Inputs.SqlWidgetPositionArgs
    {
        SizeX = 0,
        SizeY = 0,
        AutoHeight = false,
        PosX = 0,
        PosY = 0,
    },
    Text = "string",
    Title = "string",
    VisualizationId = "string",
    WidgetId = "string",
});
Copy
example, err := databricks.NewSqlWidget(ctx, "sqlWidgetResource", &databricks.SqlWidgetArgs{
	DashboardId: pulumi.String("string"),
	Description: pulumi.String("string"),
	Parameters: databricks.SqlWidgetParameterArray{
		&databricks.SqlWidgetParameterArgs{
			Name:  pulumi.String("string"),
			Type:  pulumi.String("string"),
			MapTo: pulumi.String("string"),
			Title: pulumi.String("string"),
			Value: pulumi.String("string"),
			Values: pulumi.StringArray{
				pulumi.String("string"),
			},
		},
	},
	Position: &databricks.SqlWidgetPositionArgs{
		SizeX:      pulumi.Int(0),
		SizeY:      pulumi.Int(0),
		AutoHeight: pulumi.Bool(false),
		PosX:       pulumi.Int(0),
		PosY:       pulumi.Int(0),
	},
	Text:            pulumi.String("string"),
	Title:           pulumi.String("string"),
	VisualizationId: pulumi.String("string"),
	WidgetId:        pulumi.String("string"),
})
Copy
var sqlWidgetResource = new SqlWidget("sqlWidgetResource", SqlWidgetArgs.builder()
    .dashboardId("string")
    .description("string")
    .parameters(SqlWidgetParameterArgs.builder()
        .name("string")
        .type("string")
        .mapTo("string")
        .title("string")
        .value("string")
        .values("string")
        .build())
    .position(SqlWidgetPositionArgs.builder()
        .sizeX(0)
        .sizeY(0)
        .autoHeight(false)
        .posX(0)
        .posY(0)
        .build())
    .text("string")
    .title("string")
    .visualizationId("string")
    .widgetId("string")
    .build());
Copy
sql_widget_resource = databricks.SqlWidget("sqlWidgetResource",
    dashboard_id="string",
    description="string",
    parameters=[{
        "name": "string",
        "type": "string",
        "map_to": "string",
        "title": "string",
        "value": "string",
        "values": ["string"],
    }],
    position={
        "size_x": 0,
        "size_y": 0,
        "auto_height": False,
        "pos_x": 0,
        "pos_y": 0,
    },
    text="string",
    title="string",
    visualization_id="string",
    widget_id="string")
Copy
const sqlWidgetResource = new databricks.SqlWidget("sqlWidgetResource", {
    dashboardId: "string",
    description: "string",
    parameters: [{
        name: "string",
        type: "string",
        mapTo: "string",
        title: "string",
        value: "string",
        values: ["string"],
    }],
    position: {
        sizeX: 0,
        sizeY: 0,
        autoHeight: false,
        posX: 0,
        posY: 0,
    },
    text: "string",
    title: "string",
    visualizationId: "string",
    widgetId: "string",
});
Copy
type: databricks:SqlWidget
properties:
    dashboardId: string
    description: string
    parameters:
        - mapTo: string
          name: string
          title: string
          type: string
          value: string
          values:
            - string
    position:
        autoHeight: false
        posX: 0
        posY: 0
        sizeX: 0
        sizeY: 0
    text: string
    title: string
    visualizationId: string
    widgetId: string
Copy

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

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The SqlWidget resource accepts the following input properties:

DashboardId
This property is required.
Changes to this property will trigger replacement.
string
Description string
Parameters List<SqlWidgetParameter>
Position SqlWidgetPosition
Text string
Title string
VisualizationId Changes to this property will trigger replacement. string
WidgetId Changes to this property will trigger replacement. string
DashboardId
This property is required.
Changes to this property will trigger replacement.
string
Description string
Parameters []SqlWidgetParameterArgs
Position SqlWidgetPositionArgs
Text string
Title string
VisualizationId Changes to this property will trigger replacement. string
WidgetId Changes to this property will trigger replacement. string
dashboardId
This property is required.
Changes to this property will trigger replacement.
String
description String
parameters List<SqlWidgetParameter>
position SqlWidgetPosition
text String
title String
visualizationId Changes to this property will trigger replacement. String
widgetId Changes to this property will trigger replacement. String
dashboardId
This property is required.
Changes to this property will trigger replacement.
string
description string
parameters SqlWidgetParameter[]
position SqlWidgetPosition
text string
title string
visualizationId Changes to this property will trigger replacement. string
widgetId Changes to this property will trigger replacement. string
dashboard_id
This property is required.
Changes to this property will trigger replacement.
str
description str
parameters Sequence[SqlWidgetParameterArgs]
position SqlWidgetPositionArgs
text str
title str
visualization_id Changes to this property will trigger replacement. str
widget_id Changes to this property will trigger replacement. str
dashboardId
This property is required.
Changes to this property will trigger replacement.
String
description String
parameters List<Property Map>
position Property Map
text String
title String
visualizationId Changes to this property will trigger replacement. String
widgetId Changes to this property will trigger replacement. String

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)
resources:  _:    type: databricks:SqlWidget    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
DashboardId Changes to this property will trigger replacement. string
Description string
Parameters List<SqlWidgetParameter>
Position SqlWidgetPosition
Text string
Title string
VisualizationId Changes to this property will trigger replacement. string
WidgetId Changes to this property will trigger replacement. string
DashboardId Changes to this property will trigger replacement. string
Description string
Parameters []SqlWidgetParameterArgs
Position SqlWidgetPositionArgs
Text string
Title string
VisualizationId Changes to this property will trigger replacement. string
WidgetId Changes to this property will trigger replacement. string
dashboardId Changes to this property will trigger replacement. String
description String
parameters List<SqlWidgetParameter>
position SqlWidgetPosition
text String
title String
visualizationId Changes to this property will trigger replacement. String
widgetId Changes to this property will trigger replacement. String
dashboardId Changes to this property will trigger replacement. string
description string
parameters SqlWidgetParameter[]
position SqlWidgetPosition
text string
title string
visualizationId Changes to this property will trigger replacement. string
widgetId Changes to this property will trigger replacement. string
dashboard_id Changes to this property will trigger replacement. str
description str
parameters Sequence[SqlWidgetParameterArgs]
position SqlWidgetPositionArgs
text str
title str
visualization_id Changes to this property will trigger replacement. str
widget_id Changes to this property will trigger replacement. str
dashboardId Changes to this property will trigger replacement. String
description String
parameters List<Property Map>
position Property Map
text String
title String
visualizationId Changes to this property will trigger replacement. String
widgetId Changes to this property will trigger replacement. String

Supporting Types

SqlWidgetParameter
, SqlWidgetParameterArgs

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

SqlWidgetPosition
, SqlWidgetPositionArgs

SizeX This property is required. int
SizeY This property is required. int
AutoHeight bool
PosX int
PosY int
SizeX This property is required. int
SizeY This property is required. int
AutoHeight bool
PosX int
PosY int
sizeX This property is required. Integer
sizeY This property is required. Integer
autoHeight Boolean
posX Integer
posY Integer
sizeX This property is required. number
sizeY This property is required. number
autoHeight boolean
posX number
posY number
size_x This property is required. int
size_y This property is required. int
auto_height bool
pos_x int
pos_y int
sizeX This property is required. Number
sizeY This property is required. Number
autoHeight Boolean
posX Number
posY Number

Import

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

bash

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

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.