Skip to main content

postgres_replication_group_previews

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

Overview

Namepostgres_replication_group_previews
TypeResource
Iddatabricks_workspace.postgres.postgres_replication_group_previews

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe resource name of the replication group. Format: projects/{project_id}/preview/replication-groups/{replication_group_id}
create_timestring (date-time)Server-generated timestamps.
etagstringOptional optimistic concurrency token for update and delete.
observed_metricsobjectThe latest observed replication metrics for this group.
parentstringThe parent project that owns this replication group. Format: projects/{project_id}
primary_workspacestringThe workspace currently serving writes. Server-owned.
replication_modestringHow changes are propagated from the primary workspace to its secondaries in a replication group:<br />on a fixed schedule or continuously as they occur. (REPLICATION_MODE_PREVIEW_LIVE, REPLICATION_MODE_PREVIEW_PERIODIC)
statestringThe lifecycle state of the replication group. (REPLICATION_GROUP_PREVIEW_STATE_DEGRADED, REPLICATION_GROUP_PREVIEW_STATE_DELETING, REPLICATION_GROUP_PREVIEW_STATE_FAILING_OVER, REPLICATION_GROUP_PREVIEW_STATE_PROVISIONING, REPLICATION_GROUP_PREVIEW_STATE_READY, REPLICATION_GROUP_PREVIEW_STATE_SWITCHING_OVER)
update_timestring (date-time)
workspacesarrayThe workspaces participating in this replication group. Phase 1 requires exactly 2 entries.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectparent, deployment_namepage_size, page_tokenReturns a paginated list of replication groups for the project.
createinsertparent, replication_group_preview_id, deployment_name, replication_group_previewrequest_idCreates a new replication group for the project.
failoverexecname, deployment_name, target_workspaceFails over the replication group to a target workspace, promoting the secondary to primary.
switchoverexecname, deployment_name, target_workspaceSwitches over the replication group to a target workspace with a coordinated failover.

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)
namestring
parentstring
replication_group_preview_idstring
page_sizeinteger
page_tokenstring
request_idstring

SELECT examples

Returns a paginated list of replication groups for the project.

SELECT
name,
create_time,
etag,
observed_metrics,
parent,
primary_workspace,
replication_mode,
state,
update_time,
workspaces
FROM databricks_workspace.postgres.postgres_replication_group_previews
WHERE parent = '{{ parent }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;

INSERT examples

Creates a new replication group for the project.

INSERT INTO databricks_workspace.postgres.postgres_replication_group_previews (
replication_group_preview,
parent,
replication_group_preview_id,
deployment_name,
request_id
)
SELECT
'{{ replication_group_preview }}' /* required */,
'{{ parent }}',
'{{ replication_group_preview_id }}',
'{{ deployment_name }}',
'{{ request_id }}'
;

Lifecycle Methods

Fails over the replication group to a target workspace, promoting the secondary to primary.

EXEC databricks_workspace.postgres.postgres_replication_group_previews.failover
@name='{{ name }}' --required,
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"target_workspace": "{{ target_workspace }}",
"etag": "{{ etag }}",
"request_id": "{{ request_id }}"
}'
;