Skip to main content

database_instances

Creates, updates, deletes, gets or lists a database_instances resource.

Overview

Namedatabase_instances
TypeResource
Iddatabricks_workspace.database.database_instances

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the instance. This is the unique identifier for the instance.
effective_usage_policy_idstringThe policy that is applied to the instance. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
usage_policy_idstringThe desired usage policy to associate with the instance.
capacitystringThe sku of the instance. Valid values are "CU_1", "CU_2", "CU_4", "CU_8".
child_instance_refsarrayThe refs of the child instances. This is only available if the instance is parent instance.
creation_timestringThe timestamp when the instance was created.
creatorstringThe email of the creator of the instance.
custom_tagsarrayCustom tags associated with the instance. This field is only included on create and update responses.
effective_capacitystringDeprecated. The sku of the instance; this field will always match the value of capacity. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
effective_custom_tagsarrayThe recorded custom tags associated with the instance. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
effective_enable_pg_native_loginbooleanWhether the instance has PG native password login enabled. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
effective_enable_readable_secondariesbooleanWhether secondaries serving read-only traffic are enabled. Defaults to false. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
effective_node_countintegerThe number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults to 1 primary and 0 secondaries. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
effective_retention_window_in_daysintegerThe retention window for the instance. This is the time window in days for which the historical data is retained. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
effective_stoppedbooleanWhether the instance is stopped. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
enable_pg_native_loginbooleanWhether to enable PG native password login on the instance. Defaults to false.
enable_readable_secondariesbooleanWhether to enable secondaries to serve read-only traffic. Defaults to false.
node_countintegerThe number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults to 1 primary and 0 secondaries. This field is input only, see effective_node_count for the output.
parent_instance_refobjectDatabaseInstanceRef is a reference to a database instance. It is used in the DatabaseInstance<br /> object to refer to the parent instance of an instance and to refer the child instances of an<br /> instance. To specify as a parent instance during creation of an instance, the lsn and<br /> branch_time fields are optional. If not specified, the child instance will be created from the<br /> latest lsn of the parent. If both lsn and branch_time are specified, the lsn will be used to<br /> create the child instance.
pg_versionstringThe version of Postgres running on the instance.
read_only_dnsstringThe DNS endpoint to connect to the instance for read only access. This is only available if enable_readable_secondaries is true.
read_write_dnsstringThe DNS endpoint to connect to the instance for read+write access.
retention_window_in_daysintegerThe retention window for the instance. This is the time window in days for which the historical data is retained. The default value is 7 days. Valid values are 2 to 35 days.
statestringThe current state of the instance. (AVAILABLE, DELETING, FAILING_OVER, STARTING, STOPPED, UPDATING)
stoppedbooleanWhether to stop the instance. An input only param, see effective_stopped for the output.
uidstringAn immutable UUID identifier for the instance.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, deployment_nameGet a Database Instance.
listselectdeployment_namepage_size, page_tokenList Database Instances.
find_by_uidselectuid, deployment_nameFind a Database Instance by uid.
createinsertdeployment_name, database_instanceCreate a Database Instance.
updateupdatename, update_mask, deployment_name, database_instanceUpdate a Database Instance.
deletedeletename, deployment_nameforce, purgeDelete a Database Instance.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
namestringName of the instance to delete.
uidstringUID of the cluster to get.
update_maskstring
forcebooleanBy default, a instance cannot be deleted if it has descendant instances created via PITR. If this flag is specified as true, all descendent instances will be deleted as well.
page_sizeintegerUpper bound for items returned.
page_tokenstringPagination token to go to the next page of Database Instances. Requests first page if absent.
purgebooleanDeprecated. Omitting the field or setting it to true will result in the field being hard deleted. Setting a value of false will throw a bad request.

SELECT examples

Get a Database Instance.

SELECT
name,
effective_usage_policy_id,
usage_policy_id,
capacity,
child_instance_refs,
creation_time,
creator,
custom_tags,
effective_capacity,
effective_custom_tags,
effective_enable_pg_native_login,
effective_enable_readable_secondaries,
effective_node_count,
effective_retention_window_in_days,
effective_stopped,
enable_pg_native_login,
enable_readable_secondaries,
node_count,
parent_instance_ref,
pg_version,
read_only_dns,
read_write_dns,
retention_window_in_days,
state,
stopped,
uid
FROM databricks_workspace.database.database_instances
WHERE name = '{{ name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Create a Database Instance.

INSERT INTO databricks_workspace.database.database_instances (
database_instance,
deployment_name
)
SELECT
'{{ database_instance }}' /* required */,
'{{ deployment_name }}'
RETURNING
name,
effective_usage_policy_id,
usage_policy_id,
capacity,
child_instance_refs,
creation_time,
creator,
custom_tags,
effective_capacity,
effective_custom_tags,
effective_enable_pg_native_login,
effective_enable_readable_secondaries,
effective_node_count,
effective_retention_window_in_days,
effective_stopped,
enable_pg_native_login,
enable_readable_secondaries,
node_count,
parent_instance_ref,
pg_version,
read_only_dns,
read_write_dns,
retention_window_in_days,
state,
stopped,
uid
;

UPDATE examples

Update a Database Instance.

UPDATE databricks_workspace.database.database_instances
SET
database_instance = '{{ database_instance }}'
WHERE
name = '{{ name }}' --required
AND update_mask = '{{ update_mask }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND database_instance = '{{ database_instance }}' --required
RETURNING
name,
effective_usage_policy_id,
usage_policy_id,
capacity,
child_instance_refs,
creation_time,
creator,
custom_tags,
effective_capacity,
effective_custom_tags,
effective_enable_pg_native_login,
effective_enable_readable_secondaries,
effective_node_count,
effective_retention_window_in_days,
effective_stopped,
enable_pg_native_login,
enable_readable_secondaries,
node_count,
parent_instance_ref,
pg_version,
read_only_dns,
read_write_dns,
retention_window_in_days,
state,
stopped,
uid;

DELETE examples

Delete a Database Instance.

DELETE FROM databricks_workspace.database.database_instances
WHERE name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND force = '{{ force }}'
AND purge = '{{ purge }}'
;