Skip to main content

postgres_projects

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

Overview

Namepostgres_projects
TypeResource
Iddatabricks_workspace.postgres.postgres_projects

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringOutput only. The full resource path of the project. Format: projects/{project_id}
project_idstringThe part of the name, chosen by the user when the resource was created.
create_timestring (date-time)
delete_timestring (date-time)A timestamp indicating when the project was soft-deleted. Empty if the project is not deleted, otherwise set to a timestamp in the past.
initial_branch_specobjectConfiguration for the initial default branch created as part of project creation. Allows overriding branch protection. These settings only apply at creation time and do not affect resources created after project creation.
initial_database_specobjectConfiguration for the initial Postgres database created inside the initial branch for this project. If omitted, the initial branch still gets an initial database with name ``databricks_postgres``. The initial database is always owned by the initial role (caller-provided via ``initial_role_spec`` or defaulted to the caller's identity). This field is input-only; to change databases after project creation, use the standalone Database API.
initial_endpoint_specobjectConfiguration settings for the initial Read/Write endpoint created inside the initial branch for a newly created project. If omitted, the initial endpoint created will have default settings, without high availability configured. This field does not apply to any endpoints created after project creation. Use spec.default_endpoint_settings to configure default settings for endpoints created after project creation.
initial_role_specobjectConfiguration for the initial Postgres role created inside the initial branch for this project. If omitted, the initial branch gets an initial role corresponding to the caller of the API endpoint. This field is input-only; to change roles after project creation, use the standalone Role API.
purge_timestring (date-time)A timestamp indicating when the project is scheduled for permanent deletion. Empty if the project is not deleted, otherwise set to a timestamp in the future.
specobjectThe spec contains the project configuration, including display_name, pg_version (Postgres version), history_retention_duration, and default_endpoint_settings.
statusobjectThe current status of a Project.
uidstringSystem-generated unique ID for the project.
update_timestring (date-time)A timestamp indicating when the project was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectdeployment_namepage_size, page_token, show_deletedReturns a paginated list of database projects in the workspace that the user has permission to access.
createinsertproject_id, deployment_name, projectCreates a new Lakebase Autoscaling Postgres database project, which contains branches and compute
updateupdatename, update_mask, deployment_name, snapshot_scheduleSets the snapshot schedule for a branch. The schedule field is replaced wholesale; an empty
undeleteexecname, deployment_nameUndeletes a soft-deleted project.

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)
namestringThe full resource path of the project to undelete. Format: projects/{project_id}
project_idstringThe ID to use for the Project. This becomes the final component of the project's resource name. The ID is required and must be 1-63 characters long, start with a lowercase letter, and contain only lowercase letters, numbers, and hyphens. For example, my-app becomes projects/my-app.
update_maskobjectFields to update. The only updatable path is schedule, which replaces the entire set of cadences.
page_sizeintegerUpper bound for items returned. Cannot be negative. The maximum value is 100.
page_tokenstringPage token from a previous response. If not provided, returns the first page.
show_deletedbooleanWhether to include soft-deleted projects in the response. When true, soft-deleted projects are included alongside active projects. Hard-deleted and already-purged projects are never returned.

SELECT examples

Returns a paginated list of database projects in the workspace that the user has permission to access.

SELECT
name,
project_id,
create_time,
delete_time,
initial_branch_spec,
initial_database_spec,
initial_endpoint_spec,
initial_role_spec,
purge_time,
spec,
status,
uid,
update_time
FROM databricks_workspace.postgres.postgres_projects
WHERE deployment_name = '{{ deployment_name }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
AND show_deleted = '{{ show_deleted }}'
;

INSERT examples

Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute

INSERT INTO databricks_workspace.postgres.postgres_projects (
project,
project_id,
deployment_name
)
SELECT
'{{ project }}' /* required */,
'{{ project_id }}',
'{{ deployment_name }}'
;

UPDATE examples

Sets the snapshot schedule for a branch. The schedule field is replaced wholesale; an empty

UPDATE databricks_workspace.postgres.postgres_projects
SET
snapshot_schedule = '{{ snapshot_schedule }}'
WHERE
name = '{{ name }}' --required
AND update_mask = '{{ update_mask }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND snapshot_schedule = '{{ snapshot_schedule }}' --required
RETURNING
name,
schedule;

Lifecycle Methods

Undeletes a soft-deleted project.

EXEC databricks_workspace.postgres.postgres_projects.undelete
@name='{{ name }}' --required,
@deployment_name='{{ deployment_name }}' --required
;