queries

package
v0.0.1-dev.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, opts ...client.Option) (*Client, error)

func (*Client) CreateQuery

func (c *Client) CreateQuery(ctx context.Context, req CreateQueryRequest, opts ...call.Option) (*Query, error)

Creates a query.

func (*Client) GetQuery

func (c *Client) GetQuery(ctx context.Context, req GetQueryRequest, opts ...call.Option) (*Query, error)

Gets a query.

func (*Client) ListQueries

func (c *Client) ListQueries(ctx context.Context, req ListQueriesRequest, opts ...call.Option) (*ListQueriesResponse, error)

Gets a list of queries accessible to the user, ordered by creation time. **Warning:** Calling this API concurrently 10 or more times could result in throttling, service degradation, or a temporary ban.

func (*Client) ListQueriesIter

func (c *Client) ListQueriesIter(ctx context.Context, req ListQueriesRequest, opts ...call.Option) iter.Seq2[*ListQueryObjectsResponseQuery, error]

ListQueriesIter returns an iterator that iterates over the results of ListQueries.

For example:

for item, err := range c.ListQueriesIter(ctx, ListQueriesRequest{}) {
  if err != nil {
    return err
  }
  fmt.Println(item)
}

Options opts are passed to each ListQueries call made by the iterator under the hood.

Callers who need custom pagination logic should use ListQueries directly.

func (*Client) ListVisualizationsForQuery

func (c *Client) ListVisualizationsForQuery(ctx context.Context, req ListVisualizationsForQueryRequest, opts ...call.Option) (*ListVisualizationsForQueryResponse, error)

Gets a list of visualizations on a query.

func (*Client) ListVisualizationsForQueryIter

func (c *Client) ListVisualizationsForQueryIter(ctx context.Context, req ListVisualizationsForQueryRequest, opts ...call.Option) iter.Seq2[*Visualization, error]

ListVisualizationsForQueryIter returns an iterator that iterates over the results of ListVisualizationsForQuery.

For example:

for item, err := range c.ListVisualizationsForQueryIter(ctx, ListVisualizationsForQueryRequest{}) {
  if err != nil {
    return err
  }
  fmt.Println(item)
}

Options opts are passed to each ListVisualizationsForQuery call made by the iterator under the hood.

Callers who need custom pagination logic should use ListVisualizationsForQuery directly.

func (*Client) TrashQuery

func (c *Client) TrashQuery(ctx context.Context, req TrashQueryRequest, opts ...call.Option) (*Empty, error)

Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and cannot be used for alerts. You can restore a trashed query through the UI. A trashed query is permanently deleted after 30 days.

func (*Client) UpdateQuery

func (c *Client) UpdateQuery(ctx context.Context, req UpdateQueryRequest, opts ...call.Option) (*Query, error)

Updates a query.

type CreateQueryRequest

type CreateQueryRequest struct {
	Query *CreateQueryRequestQuery
	// If true, automatically resolve query display name conflicts. Otherwise, fail
	// the request if the query's display name conflicts with an existing query's
	// display name.
	AutoResolveDisplayName *bool
}

type CreateQueryRequestQuery

type CreateQueryRequestQuery struct {
	// UUID identifying the query.
	Id *string
	// Display name of the query that appears in list views, widget headings, and on
	// the query page.
	DisplayName *string
	// General description that conveys additional information about this query such
	// as usage notes.
	Description *string
	// Username of the user that owns the query.
	OwnerUserName *string
	// ID of the SQL warehouse attached to the query.
	WarehouseId *string
	// Text of the query to be run.
	QueryText *string
	// Sets the "Run as" role for the object.
	RunAsMode RunAsMode
	// Indicates whether the query is trashed.
	LifecycleState LifecycleState
	// Username of the user who last saved changes to this query.
	LastModifierUserName *string
	// Workspace path of the workspace folder containing the object.
	ParentPath *string
	Tags       []string
	// Timestamp when this query was created.
	CreateTime *types.Time
	// Timestamp when this query was last updated.
	UpdateTime *types.Time
	// List of query parameter definitions.
	Parameters []QueryParameter
	// Whether to apply a 1000 row limit to the query result.
	ApplyAutoLimit *bool
	// Name of the catalog where this query will be executed.
	Catalog *string
	// Name of the schema where this query will be executed.
	Schema *string
}

type DatePrecision

type DatePrecision string
const (
	DatePrecision_Unspecified     DatePrecision = ""
	DatePrecision_DayPrecision    DatePrecision = "DAY_PRECISION"
	DatePrecision_MinutePrecision DatePrecision = "MINUTE_PRECISION"
	DatePrecision_SecondPrecision DatePrecision = "SECOND_PRECISION"
)

type DateRange

type DateRange struct {
	Start *string
	End   *string
}

type DateRangeValue

type DateRangeValue struct {
	Value isDateRangeValue_Value
	// Date-time precision to format the value into when the query is run. Defaults
	// to DAY_PRECISION (YYYY-MM-DD).
	Precision      DatePrecision
	StartDayOfWeek *int
}

type DateRangeValue_DynamicDateRange

type DateRangeValue_DynamicDateRange string
const (
	DateRangeValue_DynamicDateRange_Unspecified  DateRangeValue_DynamicDateRange = ""
	DateRangeValue_DynamicDateRange_Today        DateRangeValue_DynamicDateRange = "TODAY"
	DateRangeValue_DynamicDateRange_Yesterday    DateRangeValue_DynamicDateRange = "YESTERDAY"
	DateRangeValue_DynamicDateRange_ThisWeek     DateRangeValue_DynamicDateRange = "THIS_WEEK"
	DateRangeValue_DynamicDateRange_ThisMonth    DateRangeValue_DynamicDateRange = "THIS_MONTH"
	DateRangeValue_DynamicDateRange_ThisYear     DateRangeValue_DynamicDateRange = "THIS_YEAR"
	DateRangeValue_DynamicDateRange_LastWeek     DateRangeValue_DynamicDateRange = "LAST_WEEK"
	DateRangeValue_DynamicDateRange_LastMonth    DateRangeValue_DynamicDateRange = "LAST_MONTH"
	DateRangeValue_DynamicDateRange_LastYear     DateRangeValue_DynamicDateRange = "LAST_YEAR"
	DateRangeValue_DynamicDateRange_LastHour     DateRangeValue_DynamicDateRange = "LAST_HOUR"
	DateRangeValue_DynamicDateRange_Last8Hours   DateRangeValue_DynamicDateRange = "LAST_8_HOURS"
	DateRangeValue_DynamicDateRange_Last24Hours  DateRangeValue_DynamicDateRange = "LAST_24_HOURS"
	DateRangeValue_DynamicDateRange_Last7Days    DateRangeValue_DynamicDateRange = "LAST_7_DAYS"
	DateRangeValue_DynamicDateRange_Last14Days   DateRangeValue_DynamicDateRange = "LAST_14_DAYS"
	DateRangeValue_DynamicDateRange_Last30Days   DateRangeValue_DynamicDateRange = "LAST_30_DAYS"
	DateRangeValue_DynamicDateRange_Last60Days   DateRangeValue_DynamicDateRange = "LAST_60_DAYS"
	DateRangeValue_DynamicDateRange_Last90Days   DateRangeValue_DynamicDateRange = "LAST_90_DAYS"
	DateRangeValue_DynamicDateRange_Last12Months DateRangeValue_DynamicDateRange = "LAST_12_MONTHS"
)

type DateRangeValue_Value_DateRangeValue

type DateRangeValue_Value_DateRangeValue struct {
	DateRangeValue DateRange
}

DateRangeValue_Value_DateRangeValue selects DateRangeValue for DateRangeValue.Value. Manually specified date-time range value.

type DateRangeValue_Value_DynamicDateRangeValue

type DateRangeValue_Value_DynamicDateRangeValue struct {
	DynamicDateRangeValue DateRangeValue_DynamicDateRange
}

DateRangeValue_Value_DynamicDateRangeValue selects DynamicDateRangeValue for DateRangeValue.Value. Dynamic date-time range value based on current date-time.

type DateValue

type DateValue struct {
	Value isDateValue_Value
	// Date-time precision to format the value into when the query is run. Defaults
	// to DAY_PRECISION (YYYY-MM-DD).
	Precision DatePrecision
}

type DateValue_DynamicDate

type DateValue_DynamicDate string
const (
	DateValue_DynamicDate_Unspecified DateValue_DynamicDate = ""
	DateValue_DynamicDate_Now         DateValue_DynamicDate = "NOW"
	DateValue_DynamicDate_Yesterday   DateValue_DynamicDate = "YESTERDAY"
)

type DateValue_Value_DateValue

type DateValue_Value_DateValue struct {
	DateValue string
}

DateValue_Value_DateValue selects DateValue for DateValue.Value. Manually specified date-time value.

type DateValue_Value_DynamicDateValue

type DateValue_Value_DynamicDateValue struct {
	DynamicDateValue DateValue_DynamicDate
}

DateValue_Value_DynamicDateValue selects DynamicDateValue for DateValue.Value. Dynamic date-time value based on current date-time.

type Empty

type Empty struct {
}

Represents an empty message, similar to google.protobuf.Empty, which is not available in the firm right now..

type EnumValue

type EnumValue struct {
	// List of selected query parameter values.
	Values []string
	// List of valid query parameter values, newline delimited.
	EnumOptions *string
	// If specified, allows multiple values to be selected for this parameter.
	MultiValuesOptions *MultiValuesOptions
}

type GetQueryRequest

type GetQueryRequest struct {
	Id *string
}

type LifecycleState

type LifecycleState string
const (
	LifecycleState_Unspecified LifecycleState = ""
	LifecycleState_Active      LifecycleState = "ACTIVE"
	LifecycleState_Trashed     LifecycleState = "TRASHED"
)

type ListQueriesRequest

type ListQueriesRequest struct {
	PageToken *string
	PageSize  *int
}

type ListQueriesResponse

type ListQueriesResponse struct {
	Results       []ListQueryObjectsResponseQuery
	NextPageToken *string
}

type ListQueryObjectsResponseQuery

type ListQueryObjectsResponseQuery struct {
	// UUID identifying the query.
	Id *string
	// Display name of the query that appears in list views, widget headings, and on
	// the query page.
	DisplayName *string
	// General description that conveys additional information about this query such
	// as usage notes.
	Description *string
	// Username of the user that owns the query.
	OwnerUserName *string
	// ID of the SQL warehouse attached to the query.
	WarehouseId *string
	// Text of the query to be run.
	QueryText *string
	// Sets the "Run as" role for the object.
	RunAsMode RunAsMode
	// Indicates whether the query is trashed.
	LifecycleState LifecycleState
	// Username of the user who last saved changes to this query.
	LastModifierUserName *string
	// Workspace path of the workspace folder containing the object.
	ParentPath *string
	Tags       []string
	// Timestamp when this query was created.
	CreateTime *types.Time
	// Timestamp when this query was last updated.
	UpdateTime *types.Time
	// List of query parameter definitions.
	Parameters []QueryParameter
	// Whether to apply a 1000 row limit to the query result.
	ApplyAutoLimit *bool
	// Name of the catalog where this query will be executed.
	Catalog *string
	// Name of the schema where this query will be executed.
	Schema *string
}

type ListVisualizationsForQueryRequest

type ListVisualizationsForQueryRequest struct {
	Id        *string
	PageToken *string
	PageSize  *int
}

type ListVisualizationsForQueryResponse

type ListVisualizationsForQueryResponse struct {
	Results       []Visualization
	NextPageToken *string
}

type MultiValuesOptions

type MultiValuesOptions struct {
	// Character that prefixes each selected parameter value.
	Prefix *string
	// Character that separates each selected parameter value. Defaults to a comma.
	Separator *string
	// Character that suffixes each selected parameter value.
	Suffix *string
}

type NumericValue

type NumericValue struct {
	Value *float64
}

type Query

type Query struct {
	// UUID identifying the query.
	Id *string
	// Display name of the query that appears in list views, widget headings, and on
	// the query page.
	DisplayName *string
	// General description that conveys additional information about this query such
	// as usage notes.
	Description *string
	// Username of the user that owns the query.
	OwnerUserName *string
	// ID of the SQL warehouse attached to the query.
	WarehouseId *string
	// Text of the query to be run.
	QueryText *string
	// Sets the "Run as" role for the object.
	RunAsMode RunAsMode
	// Indicates whether the query is trashed.
	LifecycleState LifecycleState
	// Username of the user who last saved changes to this query.
	LastModifierUserName *string
	// Workspace path of the workspace folder containing the object.
	ParentPath *string
	Tags       []string
	// Timestamp when this query was created.
	CreateTime *types.Time
	// Timestamp when this query was last updated.
	UpdateTime *types.Time
	// List of query parameter definitions.
	Parameters []QueryParameter
	// Whether to apply a 1000 row limit to the query result.
	ApplyAutoLimit *bool
	// Name of the catalog where this query will be executed.
	Catalog *string
	// Name of the schema where this query will be executed.
	Schema *string
}

type QueryBackedValue

type QueryBackedValue struct {
	// List of selected query parameter values.
	Values []string
	// UUID of the query that provides the parameter values.
	QueryId *string
	// If specified, allows multiple values to be selected for this parameter.
	MultiValuesOptions *MultiValuesOptions
}

type QueryParameter

type QueryParameter struct {
	// Text displayed in the user-facing parameter widget in the UI.
	Title *string
	// Literal parameter marker that appears between double curly braces in the
	// query text.
	Name *string
	// Only one of the following fields may be set, depending on the type of
	// parameter.
	ParameterValue isQueryParameter_ParameterValue
}

type QueryParameter_ParameterValue_DateRangeValue

type QueryParameter_ParameterValue_DateRangeValue struct {
	DateRangeValue DateRangeValue
}

QueryParameter_ParameterValue_DateRangeValue selects DateRangeValue for QueryParameter.ParameterValue. Date-range query parameter value. Can only specify one of `dynamic_date_range_value` or `date_range_value`.

type QueryParameter_ParameterValue_DateValue

type QueryParameter_ParameterValue_DateValue struct {
	DateValue DateValue
}

QueryParameter_ParameterValue_DateValue selects DateValue for QueryParameter.ParameterValue. Date query parameter value. Can only specify one of `dynamic_date_value` or `date_value`.

type QueryParameter_ParameterValue_EnumValue

type QueryParameter_ParameterValue_EnumValue struct {
	EnumValue EnumValue
}

QueryParameter_ParameterValue_EnumValue selects EnumValue for QueryParameter.ParameterValue. Dropdown query parameter value.

type QueryParameter_ParameterValue_NumericValue

type QueryParameter_ParameterValue_NumericValue struct {
	NumericValue NumericValue
}

QueryParameter_ParameterValue_NumericValue selects NumericValue for QueryParameter.ParameterValue. Numeric query parameter value.

type QueryParameter_ParameterValue_QueryBackedValue

type QueryParameter_ParameterValue_QueryBackedValue struct {
	QueryBackedValue QueryBackedValue
}

QueryParameter_ParameterValue_QueryBackedValue selects QueryBackedValue for QueryParameter.ParameterValue. Query-based dropdown query parameter value.

type QueryParameter_ParameterValue_TextValue

type QueryParameter_ParameterValue_TextValue struct {
	TextValue TextValue
}

QueryParameter_ParameterValue_TextValue selects TextValue for QueryParameter.ParameterValue. Text query parameter value.

type RunAsMode

type RunAsMode string
const (
	RunAsMode_Unspecified RunAsMode = ""
	RunAsMode_Owner       RunAsMode = "OWNER"
	RunAsMode_Viewer      RunAsMode = "VIEWER"
)

type TextValue

type TextValue struct {
	Value *string
}

type TrashQueryRequest

type TrashQueryRequest struct {
	Id *string
}

type UpdateQueryRequest

type UpdateQueryRequest struct {
	Query      *UpdateQueryRequestQuery
	UpdateMask *types.FieldMask[UpdateQueryRequestQuery]
	Id         *string
	// If true, automatically resolve alert display name conflicts. Otherwise, fail
	// the request if the alert's display name conflicts with an existing alert's
	// display name.
	AutoResolveDisplayName *bool
}

type UpdateQueryRequestQuery

type UpdateQueryRequestQuery struct {
	// UUID identifying the query.
	Id *string `fieldmask:"id"`
	// Display name of the query that appears in list views, widget headings, and on
	// the query page.
	DisplayName *string `fieldmask:"display_name"`
	// General description that conveys additional information about this query such
	// as usage notes.
	Description *string `fieldmask:"description"`
	// Username of the user that owns the query.
	OwnerUserName *string `fieldmask:"owner_user_name"`
	// ID of the SQL warehouse attached to the query.
	WarehouseId *string `fieldmask:"warehouse_id"`
	// Text of the query to be run.
	QueryText *string `fieldmask:"query_text"`
	// Sets the "Run as" role for the object.
	RunAsMode RunAsMode `fieldmask:"run_as_mode"`
	// Indicates whether the query is trashed.
	LifecycleState LifecycleState `fieldmask:"lifecycle_state"`
	// Username of the user who last saved changes to this query.
	LastModifierUserName *string `fieldmask:"last_modifier_user_name"`
	// Workspace path of the workspace folder containing the object.
	ParentPath *string  `fieldmask:"parent_path"`
	Tags       []string `fieldmask:"tags"`
	// Timestamp when this query was created.
	CreateTime *types.Time `fieldmask:"create_time"`
	// Timestamp when this query was last updated.
	UpdateTime *types.Time `fieldmask:"update_time"`
	// List of query parameter definitions.
	Parameters []QueryParameter `fieldmask:"parameters"`
	// Whether to apply a 1000 row limit to the query result.
	ApplyAutoLimit *bool `fieldmask:"apply_auto_limit"`
	// Name of the catalog where this query will be executed.
	Catalog *string `fieldmask:"catalog"`
	// Name of the schema where this query will be executed.
	Schema *string `fieldmask:"schema"`
}

type Visualization

type Visualization struct {
	// UUID identifying the visualization.
	Id *string
	// The display name of the visualization.
	DisplayName *string
	// The type of visualization: counter, table, funnel, and so on.
	Type *string
	// The timestamp indicating when the visualization was created.
	CreateTime *types.Time
	// The timestamp indicating when the visualization was updated.
	UpdateTime *types.Time
	// The visualization query plan varies widely from one visualization type to the
	// next and is unsupported. Databricks does not recommend modifying the
	// visualization query plan directly.
	SerializedQueryPlan *string
	// The visualization options varies widely from one visualization type to the
	// next and is unsupported. Databricks does not recommend modifying
	// visualization options directly.
	SerializedOptions *string
	// UUID of the query that the visualization is attached to.
	QueryId *string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL