---
title: Manage projects
description: Create, configure, and manage Lakebase Postgres projects including settings, resources, and lifecycle management.
canonical_url: https://docs.databricks.com/gcp/en/oltp/projects/manage-projects
---

# Manage projects

A project is the top-level container for your Lakebase resources, including branches, computes, databases, and roles. This page explains how to create projects, understand their structure, configure settings, and manage their lifecycle.

If you're new to Lakebase, start with [Get started](https://docs.databricks.com/gcp/en/oltp/projects/get-started.md) to create your first project.

## <a id="understanding" />Understanding projects

### <a id="project-structure" />Project structure

Understanding the Lakebase project structure helps you organize and manage your resources effectively. A project is the top-level container for your databases, branches, computes, and related resources. Each project includes settings for compute defaults, restore windows, and updates that apply to all branches within the project.

At the top level, a project contains one or more branches. Within a project, you can create branches for different environments such as development, testing, staging, and production. Each branch contains its own computes, roles, and databases.

```
Project
  └── Branches (main, development, staging, etc.)
        ├── Computes (R/W compute)
        ├── Roles (Postgres roles)
        └── Databases (Postgres databases)
```

#### <a id="branch" />Branches

Data resides in branches. Each Lakebase project is created with a root branch called `production`, which cannot be deleted. While you can create additional branches and designate a different branch as your default branch, the root branch cannot be deleted.

You can create child branches from any branch in your project. When you create a child branch, it inherits all databases, roles, and data from its parent branch at the time of creation. Subsequent changes in the parent branch don't automatically propagate to the child branch, enabling isolated development, testing, or experimentatation.

Each branch can contain multiple databases and roles. Learn more: [Manage branches](https://docs.databricks.com/gcp/en/oltp/projects/manage-branches.md)

#### <a id="compute" />Computes

A compute is a virtualized computing resource that includes vCPU and memory for running Postgres. When you create a project, a primary R/W (read-write) compute is created for the project's default branch. Each branch has a single primary R/W compute. To connect to a database that resides on a branch, you must connect through the R/W compute associated with the branch.

In addition to the primary R/W compute, you can add one or more read replica (read-only) computes to any branch. Read replicas enable you to offload read-only workloads from your primary compute for use cases such as horizontal read scaling, analytics and reporting queries, and read-only access for users or applications. Learn more: [Manage computes](https://docs.databricks.com/gcp/en/oltp/projects/manage-computes.md), [Read replicas](https://docs.databricks.com/gcp/en/oltp/projects/read-replicas.md)

#### <a id="role" />Roles

Roles are Postgres roles. A role is required to create and access a database. A role belongs to a branch. When you create a project, a Postgres role is automatically created for your Databricks identity (for example, `user@databricks.com`), which is the owner of the default `databricks_postgres` database. Any role created in the Lakebase UI is created with `databricks_superuser` privileges. There is a limit of 500 roles per branch. Learn more: [Manage roles](https://docs.databricks.com/gcp/en/oltp/projects/manage-roles.md)

#### <a id="database" />Databases

A database is a container for SQL objects such as schemas, tables, views, functions, and indexes. In Lakebase, a database belongs to a branch. The default branch of your project is created with a database named `databricks_postgres`. There is a limit of 500 databases per branch. Learn more: [Manage databases](https://docs.databricks.com/gcp/en/oltp/projects/manage-databases.md)

#### <a id="schema" />Schemas

All databases in Lakebase are created with a `public` schema, which is the default behavior for any standard Postgres instance. SQL objects are created in the `public` schema by default.

### <a id="limits" />Project limits

Lakebase Postgres enforces the following limits for projects:

| Resource                                        | Limit                 |
| ----------------------------------------------- | --------------------- |
| Maximum number of concurrently active computes  | 20                    |
| Maximum number of read replicas per branch      | 6                     |
| Maximum number of branches per project          | 500                   |
| Maximum number of Postgres roles per branch     | 500                   |
| Maximum number of Postgres databases per branch | 500                   |
| Database storage quota (per branch)             | Adjustable on request |
| Maximum number of projects per workspace        | 1000                  |
| Maximum number of protected branches            | 1                     |
| Maximum number of root branches                 | 3                     |
| Maximum number of manual snapshots              | 10                    |
| Maximum history retention period                | 30 days               |
| Minimum scale to zero time                      | 60 seconds            |
| Maximum scale to zero time                      | 7 days                |

#### <a id="concurrent-limit" />Concurrently active compute limit

The concurrently active compute limit caps how many computes can run at the same time to prevent resource exhaustion. This limit protects against accidental resource surges, such as starting many compute endpoints at once. The default limit is 20 concurrently active computes per project.

**Important:** The default branch is exempt from this limit, ensuring it remains available at all times.

When you exceed the limit, additional computes beyond the limit remain suspended and you see an error when attempting to connect to them. To resolve this:

1. Suspend other active computes and try again.
2. If you encounter this error often, contact Databricks Support to request a limit increase.

> [!NOTE]
>
> Computes with [scale to zero](https://docs.databricks.com/gcp/en/oltp/projects/scale-to-zero.md) enabled automatically suspend after a period of inactivity, helping you stay within the concurrently active compute limit.

#### <a id="storage-quota" />Database storage quota

Each branch has a database storage quota. This is an operational quota rather than an architectural limit, because data lives in cloud object storage instead of on a provisioned local disk. If you need a larger quota, contact Databricks Support.

When a database reaches its quota, write performance drops, but you can still drop or delete data to reclaim space.

A compute picks up the current quota the next time it starts or restarts. A compute that is already running continues to use the quota it started with until its next restart.

Only your actual data (tables and indexes, as reported by Postgres) counts against the quota. History retained for [point-in-time restore](https://docs.databricks.com/gcp/en/oltp/projects/point-in-time-restore.md) doesn't.

### <a id="availability" />Region availability

**Supported regions:**

* `us-east1` (US East - South Carolina)
* `us-east4` (US East - Virginia)
* `us-central1` (US Central - Iowa)
* `us-west1` (US West - Oregon)
* `europe-west3` (Europe - Frankfurt)
* `asia-southeast1` (Asia Pacific - Singapore)

Your Lakebase project is created in your Databricks workspace region.

#### Postgres version support

Lakebase supports Postgres 16, Postgres 17, Postgres 18, and Postgres 19. Postgres 18 is the default version. To use a different version, select it when creating a new project. Some features aren't available on Postgres 19. See [Postgres 19 limitations](https://docs.databricks.com/gcp/en/oltp/projects/postgres-version-support.md#pg19-limitations). To move an existing project to a newer major version, see [Major version upgrades](https://docs.databricks.com/gcp/en/oltp/projects/postgres-version-support.md#major).

## <a id="create-manage" />Create and manage projects

### <a id="create-projects" />Create a project

You can create multiple projects in Lakebase Postgres to keep applications or customers fully isolated, ensuring clean separation of data and resources.

> [!NOTE]
> **Preview**
>
> In workspaces enrolled in the serverless compute policy Private Preview:
>
> * Creating a Lakebase project requires `CAN_USE` or `CAN_MANAGE` on a policy that allows Lakebase.
> * Changing compute capacity or scale-to-zero settings requires `CAN_MANAGE` on the Lakebase project and `CAN_USE` or `CAN_MANAGE` on its policy. This applies even if the policy sets no limit for the setting.
> * Changing a Lakebase project's display name requires only `CAN_MANAGE` on the Lakebase project.
> * Replacing the policy requires `CAN_MANAGE` on the Lakebase project and `CAN_USE` or `CAN_MANAGE` on both policies. Clearing `spec.compute_policy_id` assigns the Default Lakebase Policy as the replacement.
>
> Updated settings must satisfy the policy's current constraints and preserve its required tag key-value pairs. See [Permissions for configuration changes](https://docs.databricks.com/gcp/en/admin/compute-policies/serverless.md#configuration-permissions).
>
> To request preview access, contact your Databricks account team.

To select a compute policy in the preview, set `spec.compute_policy_id` in the Postgres API request. The Lakebase project's compute configuration must satisfy that policy's limits. For an example, see [Create a Lakebase project with a policy](https://docs.databricks.com/gcp/en/admin/compute-policies/serverless.md#create-lakebase-project).

The `budget_policy_id` in the examples below selects a [serverless usage policy](https://docs.databricks.com/gcp/en/admin/usage/budget-policies.md) for cost attribution.

To create a project:

#### UI

1. Click the app switcher in the top right corner to open the Lakebase App.
2. Click **New project**.
3. Configure your project settings:
   * **Display name**: Enter a name for your project. You can use any characters, including spaces and special characters. Common naming patterns include naming after the application (for example, `My Analytics App`) or the customer or tenant the project serves (for example, `Acme Corp DB`). A resource name is derived from your display name automatically and is used to identify the project in API and SDK calls. The dialog shows the resulting resource name (for example, `projects/my-analytics-app`) so you can verify it before creating the project.
   * **Postgres version**: Select the Postgres version you want to use.
   * **Serverless usage policy** (optional): Select a serverless usage policy to attribute serverless compute costs to a specific policy. See [Serverless usage policies](https://docs.databricks.com/gcp/en/admin/usage/budget-policies.md).

The **Create project** dialog shows the project configuration options.

![Create project dialog](https://docs.databricks.com/gcp/en/images/oltp/create-project-dialog.png)

The **Region** for your Lakebase project is set to your Databricks workspace region and cannot be modified.

#### Python SDK

```python
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.postgres import Project, ProjectSpec

# Initialize the Workspace client
w = WorkspaceClient()

# Create a project with a custom project ID
operation = w.postgres.create_project(
    project=Project(
        spec=ProjectSpec(
            display_name="My Application",
            pg_version=17,
            budget_policy_id="<policy-id>"
        )
    ),
    project_id="my-app"
)

# Wait for operation to complete
result = operation.wait()
print(f"Created project: {result.name}")
print(f"Display name: {result.status.display_name}")
print(f"Postgres version: {result.status.pg_version}")
```

#### Java SDK

```java
import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.service.postgres.*;

// Initialize the Workspace client
WorkspaceClient w = new WorkspaceClient();

// Create a project with a custom project ID
CreateProjectOperation operation = w.postgres().createProject(
    new CreateProjectRequest()
        .setProjectId("my-app")
        .setProject(new Project()
            .setSpec(new ProjectSpec()
                .setDisplayName("My Application")
                .setPgVersion(17L)))
);

// Wait for operation to complete
Project result = operation.waitForCompletion();
System.out.println("Created project: " + result.getName());
System.out.println("Display name: " + result.getStatus().getDisplayName());
System.out.println("Postgres version: " + result.getStatus().getPgVersion());
```

#### CLI

```bash
# Create a project with a custom project ID
databricks postgres create-project my-app \
  --json '{
    "spec": {
      "display_name": "My Application",
      "pg_version": 17,
      "budget_policy_id": "<policy-id>"
    }
  }'
```

#### curl

Create a project with a custom project ID. The `project_id` is specified as a query parameter and becomes part of the project's resource name (for example, `projects/my-app`).

```bash
curl -X POST "$WORKSPACE/api/2.0/postgres/projects?project_id=my-app" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "spec": {
      "display_name": "My Application",
      "pg_version": 17,
      "budget_policy_id": "<policy-id>"
    }
  }' | jq
```

This is a long-running operation. The response includes an operation name that you can use to check the status. The operation typically completes within seconds.

The `project_id` parameter is required.

> [!NOTE]
>
> If you are creating a project with the same ID as a recently deleted project, note that deleted project IDs are reserved for 7 days. To reuse the ID immediately, [permanently delete](https://docs.databricks.com/gcp/en/oltp/projects/manage-projects.md#permanently-delete-a-project) the original project first.

A new project includes the following resources by default:

* A single `production` branch (the default branch)

* A single primary read-write compute associated with the branch with the following default settings:

  | Branch       | Compute Units (CU) | HA                                                                                | Autoscaling                                                                | Scale-to-zero                                                                      |
  | ------------ | ------------------ | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
  | `production` | 8–16 CU            | [Disabled](https://docs.databricks.com/gcp/en/oltp/projects/high-availability.md) | [Enabled](https://docs.databricks.com/gcp/en/oltp/projects/autoscaling.md) | [Enabled (24h)](https://docs.databricks.com/gcp/en/oltp/projects/scale-to-zero.md) |

  When you create a Lakebase project, the `production` branch is created with a compute that has scale-to-zero enabled by default with a 24-hour inactivity timeout. If a [serverless compute policy](https://docs.databricks.com/gcp/en/admin/compute-policies/serverless.md#lakebase-settings) requires an inactivity timeout, keep scale to zero enabled and choose a timeout within its limit. Otherwise, you can adjust the timeout or turn off scale to zero for this compute.

* A Postgres database (named `databricks_postgres`)

* A Postgres role for your Databricks identity (for example, `user@example.com`)

To change compute settings for an existing project, see [Configure project settings](https://docs.databricks.com/gcp/en/oltp/projects/manage-projects.md#configure-projects). To modify default compute settings for new projects, see **Compute defaults** in [Configure project settings](https://docs.databricks.com/gcp/en/oltp/projects/manage-projects.md#configure-projects).

### <a id="get-project" />Get project details

Retrieve details for a specific project.

#### UI

1. Click the app switcher in the top right corner to open the Lakebase App.
2. Select your project from the projects list to view its details.

#### Python SDK

```python
from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

# Get project details
project = w.postgres.get_project(name="projects/my-project")

print(f"Project: {project.name}")
print(f"Display name: {project.status.display_name}")
print(f"Postgres version: {project.status.pg_version}")
```

#### Java SDK

```java
import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.service.postgres.Project;

WorkspaceClient w = new WorkspaceClient();

// Get project details
Project project = w.postgres().getProject("projects/my-project");

System.out.println("Project: " + project.getName());
System.out.println("Display name: " + project.getStatus().getDisplayName());
System.out.println("Postgres version: " + project.getStatus().getPgVersion());
```

#### CLI

```bash
# Get project details
databricks postgres get-project projects/my-project
```

#### curl

```bash
curl -X GET "$WORKSPACE/api/2.0/postgres/projects/my-project" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" | jq
```

**Response includes:**

* `name`: Resource name (`projects/my-project`)
* `status`: Project configuration and current state (display\_name, pg\_version, etc.)

Note: The `spec` field is not populated for GET operations. All resource properties are returned in the `status` field.

### <a id="list-projects" />List projects

List all projects in your workspace.

#### UI

1. Click the app switcher in the top right corner to open the Lakebase App.
2. The projects list displays all projects you have access to.

#### Python SDK

```python
from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

# List all projects
projects = w.postgres.list_projects()

for project in projects:
    print(f"Project: {project.name}")
    print(f"  Display name: {project.status.display_name}")
    print(f"  Postgres version: {project.status.pg_version}")
```

#### Java SDK

```java
import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.service.postgres.*;

WorkspaceClient w = new WorkspaceClient();

// List all projects
for (Project project : w.postgres().listProjects(new ListProjectsRequest())) {
    System.out.println("Project: " + project.getName());
    System.out.println("  Display name: " + project.getStatus().getDisplayName());
    System.out.println("  Postgres version: " + project.getStatus().getPgVersion());
}
```

#### CLI

```bash
# List all projects
databricks postgres list-projects
```

#### curl

```bash
curl -X GET "$WORKSPACE/api/2.0/postgres/projects" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" | jq
```

**Response format:**

```json
{
  "projects": [
    {
      "name": "projects/my-project",
      "status": {
        "display_name": "My Project",
        "pg_version": 17
      }
    }
  ]
}
```

### <a id="configure-projects" />Configure project settings

For policy permissions and replacement requirements in the preview, see [Permissions for configuration changes](https://docs.databricks.com/gcp/en/admin/compute-policies/serverless.md#configuration-permissions) and [Replace a Lakebase project's policy](https://docs.databricks.com/gcp/en/admin/compute-policies/serverless.md#change-lakebase-policy).

To change a Lakebase project's settings, open **Settings** in its dashboard.

#### <a id="general" />General settings

The general settings page displays the following fields:

* **Display name**: The editable display name for your project.
* **Resource name**: Read-only. The full resource path for your project (format: `projects/{project_id}`). Use this value in API and SDK calls to identify the project.
* **UID**: Read-only. The system-generated unique identifier for your project.
* **Serverless usage policy**: Associate a serverless usage policy with your project to attribute serverless compute costs to a specific policy. See [Serverless usage policies](https://docs.databricks.com/gcp/en/admin/usage/budget-policies.md).
* **Custom tags**: Add key-value tags to your project. Tags are logged in your account's billable usage records (`system.billing.usage`) and can be used to track costs by team, project, or cost center. See [Custom tags](https://docs.databricks.com/gcp/en/admin/account-settings/usage-detail-tags.md). When you update custom tags using the API or CLI, the new list replaces all existing tags.

##### UI

![Project name and ID settings](https://docs.databricks.com/gcp/en/images/oltp/project-settings.png)

##### Python SDK

```python
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.postgres import Project, ProjectSpec, ProjectCustomTag, FieldMask

w = WorkspaceClient()

# Update project display name
w.postgres.update_project(
    name="projects/my-project",
    update_mask=FieldMask(field_mask=["spec.display_name"]),
    project=Project(spec=ProjectSpec(display_name="My Updated Project Name"))
).wait()

# Update serverless usage policy
w.postgres.update_project(
    name="projects/my-project",
    update_mask=FieldMask(field_mask=["spec.budget_policy_id"]),
    project=Project(spec=ProjectSpec(budget_policy_id="<policy-id>"))
).wait()

# Update custom tags (replaces all existing tags)
w.postgres.update_project(
    name="projects/my-project",
    update_mask=FieldMask(field_mask=["spec.custom_tags"]),
    project=Project(spec=ProjectSpec(custom_tags=[
        ProjectCustomTag(key="team", value="data-eng"),
        ProjectCustomTag(key="cost-center", value="1234")
    ]))
).wait()
```

##### CLI

```bash
# Update project display name
databricks postgres update-project projects/my-project spec.display_name \
  --json '{
    "spec": {
      "display_name": "My Updated Project Name"
    }
  }'

# Update serverless usage policy
databricks postgres update-project projects/my-project spec.budget_policy_id \
  --json '{
    "spec": {
      "budget_policy_id": "<policy-id>"
    }
  }'

# Update custom tags
databricks postgres update-project projects/my-project spec.custom_tags \
  --json '{
    "spec": {
      "custom_tags": [
        {"key": "team", "value": "data-eng"},
        {"key": "cost-center", "value": "1234"}
      ]
    }
  }'
```

##### curl

```bash
# Update project display name
curl -X PATCH "$WORKSPACE/api/2.0/postgres/projects/my-project?update_mask=spec.display_name" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "spec": {
      "display_name": "My Updated Project Name"
    }
  }' | jq

# Update serverless usage policy
curl -X PATCH "$WORKSPACE/api/2.0/postgres/projects/my-project?update_mask=spec.budget_policy_id" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "spec": {
      "budget_policy_id": "<policy-id>"
    }
  }' | jq

# Update custom tags
curl -X PATCH "$WORKSPACE/api/2.0/postgres/projects/my-project?update_mask=spec.custom_tags" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "spec": {
      "custom_tags": [
        {"key": "team", "value": "data-eng"},
        {"key": "cost-center", "value": "1234"}
      ]
    }
  }' | jq
```

These are long-running operations. The response includes an operation name that you can use to check the status.

#### <a id="defaults" />Compute defaults

These defaults are used as the initial settings for any primary or read replica computes you create. Modifying these defaults does not alter the settings of any existing computes.

If your workspace is enrolled in the serverless compute policy Private Preview, choose defaults that satisfy the applicable [serverless compute policy](https://docs.databricks.com/gcp/en/admin/compute-policies/serverless.md#lakebase-settings) limits on capacity and idle time before scale to zero. For the permissions required to change these defaults, see [Permissions for configuration changes](https://docs.databricks.com/gcp/en/admin/compute-policies/serverless.md#configuration-permissions).

**Default values:**

* **Compute size:** 2 ↔ 4 CU (autoscaling range; \~4–8 GB RAM)
* **Scale to zero:** Enabled by default—**Suspend compute after a period of inactivity** is checked, with **Suspend after 24 hours** selected

Click **Modify defaults** to open the dialog and change these values.

> [!NOTE]
>
> To modify settings for an existing compute, see [Manage computes](https://docs.databricks.com/gcp/en/oltp/projects/manage-computes.md).

Lakebase Postgres supports compute sizes from 0.5 CU to 112 CU. Autoscaling is available for computes up to 64 CU (0.5, then integer increments: 1, 2, 3... 64). Larger fixed-size computes are available up to 112 CU. Each Compute Unit (CU) provides 2 GB of RAM.

**Representative sizes:**

| Compute Units | RAM    |
| ------------- | ------ |
| 0.5 CU        | 1 GB   |
| 1 CU          | 2 GB   |
| 4 CU          | 8 GB   |
| 8 CU          | 16 GB  |
| 16 CU         | 32 GB  |
| 32 CU         | 64 GB  |
| 64 CU         | 128 GB |
| 112 CU        | 224 GB |

* To enable autoscaling, set a compute size range using the slider. Autoscaling dynamically adjusts compute resources based on workload demand. See [Autoscaling](https://docs.databricks.com/gcp/en/oltp/projects/autoscaling.md).
* Adjust the scale-to-zero setting to increase or decrease the amount of inactive compute time before a compute suspends (from 60 seconds up to 7 days when enabled). You can also disable scale to zero for an always-active compute if the applicable compute policy permits it. See [Scale to zero](https://docs.databricks.com/gcp/en/oltp/projects/scale-to-zero.md).

![Compute defaults settings](https://docs.databricks.com/gcp/en/images/oltp/compute-defaults.png)

#### <a id="restore" />History window

Configure the history window length for your project. By default, Lakebase retains a history of changes for root branches in your project, enabling [point-in-time restore](https://docs.databricks.com/gcp/en/oltp/projects/point-in-time-restore.md) for recovering lost data, [querying data at a point in time](https://docs.databricks.com/gcp/en/oltp/projects/point-in-time-branching.md) for investigating data issues, and [branching from past states](https://docs.databricks.com/gcp/en/oltp/projects/manage-branches.md) for development workflows.

You can set the history window from 2 days up to 30 days, with a default of 7 days. Note that:

* Extending the history window increases your storage
* The history window setting affects all branches in your project

![History window settings in Lakebase project settings showing a slider to configure the restore window length from 2 days to 30 days.](https://docs.databricks.com/gcp/en/images/oltp/history-window.png)

#### <a id="permissions" />Project permissions

Control who can access and manage your Lakebase project by granting permissions to Databricks identities, groups, and service principals. Project permissions determine what actions users can perform within the project, such as creating branches, managing computes, and viewing connection details.

**Permission types:**

* **CAN CREATE**: View and create project resources
* **CAN USE**: View and use project resources (list, view, connect, and perform certain branch operations) without creating or deleting projects or branches
* **CAN MANAGE**: Full control over project configuration and resources

**Default permissions:**

When you create a project, the following permissions are automatically assigned:

* **Project owner** (the user who created the project): CAN MANAGE (full control)
* **Workspace users**: CAN CREATE (can view and create projects)
* **Workspace admins**: CAN MANAGE (full control)

For the additional policy permissions required in the preview, see [Permissions for configuration changes](https://docs.databricks.com/gcp/en/admin/compute-policies/serverless.md#configuration-permissions).

To grant access to other users, see [Manage project permissions](https://docs.databricks.com/gcp/en/oltp/projects/manage-project-permissions.md).

> [!NOTE]
>
> **Project permissions and database access are separate**
>
> Project permissions control Lakebase platform actions, while database access is controlled by Postgres roles and their associated permissions. See [Create Postgres roles](https://docs.databricks.com/gcp/en/oltp/projects/postgres-roles.md) and [Manage database permissions](https://docs.databricks.com/gcp/en/oltp/projects/manage-roles-permissions.md).

![Project permissions settings](https://docs.databricks.com/gcp/en/images/oltp/project-permissions.png)

#### <a id="update" />Updates

To keep your Lakebase computes and Postgres instances up to date, Lakebase automatically applies scheduled updates that include Postgres minor version upgrades, security patches, and platform features. Updates are applied to the computes within your project and require a brief compute restart that takes a few seconds.

Updates are applied automatically, but you can set a preferred day and time for updates. Restarts occur within your selected time window.

For detailed information about updates, see [Manage updates](https://docs.databricks.com/gcp/en/oltp/projects/updates.md).

![Updates settings](https://docs.databricks.com/gcp/en/images/oltp/updates.png)

### <a id="delete-projects" />Delete a project

When you delete a project, it enters a soft-deleted state by default and is retained for 7 days before being permanently deleted. During this window, you can recover the project and restore all its data. See [Recover a deleted project](https://docs.databricks.com/gcp/en/oltp/projects/manage-projects.md#recover-project). To skip the retention period and remove the project immediately, see [Permanently delete a project](https://docs.databricks.com/gcp/en/oltp/projects/manage-projects.md#permanently-delete-a-project).

> [!NOTE]
>
> While a project is soft-deleted, attempts to connect to it or retrieve database credentials return generic errors (such as endpoint not found or connection refused) rather than an error indicating that the project was deleted. If you encounter these errors unexpectedly, check whether the project has been soft-deleted by listing projects with `show_deleted=true`. See [Find soft-deleted projects](https://docs.databricks.com/gcp/en/oltp/projects/manage-projects.md#find-deleted-projects).

#### Before deleting

Databricks recommends deleting all associated Unity Catalog catalogs and synced tables before deleting the project. Otherwise, attempting to view catalogs or run SQL queries that reference them results in errors.

If you are not the owner of the tables or catalogs, you must reassign ownership to yourself before deletion.

> [!NOTE]
>
> Only users with **CAN MANAGE** permission on the Lakebase project can delete it. See [Project ACLs](https://docs.databricks.com/aws/en/security/auth/access-control/#project-acls) and [Manage project permissions](https://docs.databricks.com/gcp/en/oltp/projects/manage-project-permissions.md) for details.

#### Delete a project

To delete a project:

##### UI

1. Navigate to your project's **Settings** in the Lakebase App.
2. In the **Delete project** section, click **Delete** and enter the project name to confirm deletion.

##### Python SDK

```python
from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

# Delete a project
operation = w.postgres.delete_project(name="projects/my-project")

print(f"Delete operation started: {operation.name()}")
```

This is a long-running operation. The project and all its resources (branches, endpoints, databases, roles, data) will be deleted.

##### Java SDK

```java
import com.databricks.sdk.WorkspaceClient;

WorkspaceClient w = new WorkspaceClient();

// Delete a project
w.postgres().deleteProject("projects/my-project");

System.out.println("Delete operation started");
```

This is a long-running operation. The project and all its resources (branches, endpoints, databases, roles, data) will be deleted.

##### CLI

```bash
# Delete a project
databricks postgres delete-project projects/my-project
```

This command returns immediately. The project and all its resources will be deleted.

##### curl

```bash
curl -X DELETE "$WORKSPACE/api/2.0/postgres/projects/my-project" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" | jq
```

This is a long-running operation. The response includes an operation name that you can use to check the deletion status.

#### <a id="permanently-delete-a-project" />Permanently delete a project

To permanently delete a Lakebase project immediately without waiting for the 7-day soft-delete retention period to expire:

##### Python SDK

```python
from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

operation = w.postgres.delete_project(name="projects/my-project", purge=True)
operation.wait()
```

##### Java SDK

```java
import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.service.postgres.DeleteProjectRequest;

WorkspaceClient w = new WorkspaceClient();

w.postgres().deleteProject(
    new DeleteProjectRequest()
        .setName("projects/my-project")
        .setPurge(true)
).waitForCompletion();
```

##### CLI

```bash
databricks postgres delete-project projects/my-project --purge
```

##### curl

```bash
curl -X DELETE "$WORKSPACE/api/2.0/postgres/projects/my-project?purge=true" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" | jq
```

### <a id="recover-project" />Recover a deleted project

When you delete a Lakebase project, it enters a soft-deleted state and is retained for 7 days before being permanently deleted. During this window, you can recover the project and restore all its data.

#### What is restored

Recovering a soft-deleted project restores the following:

* All branches and their data
* All Postgres databases and roles
* All compute endpoints and their configurations
* Project settings, including compute defaults, restore window settings, and update preferences
* Project permissions

> [!NOTE]
>
> Some resources may require reconfiguration after recovery. Contact [Databricks Support](https://help.databricks.com) if you encounter issues after recovering a project.

#### <a id="find-deleted-projects" />Find soft-deleted projects

To list all projects including soft-deleted ones, use the `show_deleted` parameter. This is useful for finding the resource name of a project you want to recover.

##### Python SDK

```python
from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

for project in w.postgres.list_projects(show_deleted=True):
    print(f"Project: {project.name}")
    print(f"  Display name: {project.status.display_name}")
    if project.delete_time:
        print(f"  Deleted: {project.delete_time}")
        print(f"  Purge time: {project.purge_time}")
```

##### CLI

```bash
databricks postgres list-projects --show-deleted
```

##### curl

```bash
curl -X GET "$WORKSPACE/api/2.0/postgres/projects?show_deleted=true" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" | jq
```

#### Recover a project

To recover a soft-deleted Lakebase project:

##### Python SDK

```python
from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

operation = w.postgres.undelete_project(name="projects/my-project")
operation.wait()
```

##### Java SDK

```java
import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.service.postgres.UndeleteProjectRequest;

WorkspaceClient w = new WorkspaceClient();

w.postgres().undeleteProject(
    new UndeleteProjectRequest().setName("projects/my-project")
).waitForCompletion();
```

##### CLI

```bash
databricks postgres undelete-project projects/my-project
```

##### curl

```bash
curl -X POST "$WORKSPACE/api/2.0/postgres/projects/my-project/undelete" \
  -H "Authorization: Bearer ${DATABRICKS_TOKEN}" | jq
```
