Skip to main content

Access a database instance from the SQL editor

Preview

This feature is in Public Preview in the following regions: us-east-1, us-west-2, eu-west-1, ap-southeast-1, ap-southeast-2, eu-central-1, us-east-2, ap-south-1.

This page describes how to access a Lakebase database instance from the SQL editor to run PostgreSQL commands and queries.

Before you begin

Verify that you meet the following requirements before connecting:

The database instance creator already has the necessary permissions to access the database instance from the SQL editor. The instance creator can also add additional users to the instance and can grant Postgres permissions to the user.

Create a new query

Create a new SQL query in the SQL editor.

  1. Click Compute in the workspace sidebar.
  2. Click Database instances.
  3. Select the database instance you want to run PostgreSQL queries on.
  4. Click New Query in the upper-right.

Run queries

To run PostgreSQL queries, select the appropriate database and schema in the dropdown selector.

  1. Select the desired database and schema in the dropdown selector next to Run all.
  2. View databases, schemas, tables, and columns in PostgreSQL Databases Data icon..
  3. You can fill in a table reference from the Schema Browser by clicking Chevron double right icon. next to the desired table.
  4. Write a PostgreSQL query, and click Run all.

Supported functionality and limitations

  1. The query access control list (ACL) permissions model applies:
    1. The execution happens with the Databricks identity of the user who clicks Run.
    2. Anyone with at least CAN VIEW access on the query can see the results as they appear in the SQL Editor.
  2. Connection-scoped objects, such as temporary tables and transactions, work in a single cell. They do not work across different Run clicks, as each is its own session.
  3. $$ blocks don’t work if statements inside have semicolons.