Skip to main content

Use DBOS With Lakebase

Here's how to connect your DBOS application running on your computer or cloud environment to your Databricks Lakebase Postgres database.

1. Set up a Local Application

If you haven't already, follow the quickstart to set up a DBOS application locally. The rest of this guide will assume you have a local application.

2. Connect to Lakebase

From the "Roles & Databases" tab of your Lakebase console, create a Postgres role that you will use to access your Lakebase database from your DBOS application.

Create Role

Next, click "Connect" on your Lakebase console to retrieve connection information for your Lakebase database. You should see a screen that looks like this:

Create Role

This page shows the connection string for your database. There are a few settings you may wish to alter before retrieving this connection string:

  1. Select the Postgres role you created from the dropdown.
  2. Make sure you are viewing your "Connection string" from the dropdown.
  3. By default, you will use the databricks_postgres database. If you want to use a different database, create it from the dropdown.

When you are ready, copy the connection string (including the password) from the dashboard and set the DBOS_SYSTEM_DATABASE_URL environment variable to it:

export DBOS_SYSTEM_DATABASE_URL="<your connection string>"

3. Launch Your Application

Now, launch your DBOS application. It should successfully connect to your Lakebase database, printing your masked Lakebase database URL on startup.

After connecting your DBOS application to Lakebase, you can use the Lakebase console to view your DBOS system tables. Open the "Tables" tab in the Lakebase console. For your database, select the database to which you connected your DBOS application (default databricks_postgres). For your schema, select "dbos". You can now see DBOS durably checkpoint your workflows to your Lakebase database:

Lakebase Tables Dashboard