Skip to main content

Query Lakebase tables with Lakehouse//RT

Beta

This feature is in Beta. Reach out to your Databricks account team to enable this feature in your workspace.

Lakehouse//RT on Lakebase lets users and agents run analytical queries on live Lakebase tables from a Lakehouse//RT warehouse without building a pipeline or adding load to the Postgres compute that serves your application. Lakehouse//RT reads your table data directly from Lakebase storage and runs the query on its own compute, so you can analyze data that your application just committed. This capability is part of the Lake Transactional/Analytical Processing (LTAP) architecture, which serves transactional and analytical workloads from one copy of your data.

To query Lakebase tables with Lakehouse//RT:

  1. Create a Lakehouse//RT warehouse.
  2. Register your Lakebase database in Unity Catalog.
  3. Grant Unity Catalog access to the users who run analytics.
  4. Query the tables from the SQL editor, a notebook, or a dashboard. See Query Lakebase tables.

When to use Lakehouse//RT on Lakebase​

Use Lakehouse//RT on Lakebase when you apply the LTAP architecture to your application. You can analyze data as soon as Lakebase commits it, with transactionally consistent reads, so you have fewer pipelines to manage. Common use cases include:

  • Operational analytics on live data: Dashboards, reports, and investigations on orders, payments, bookings, or telemetry that your application just wrote.
  • Live and historical data together: Join or UNION recent data in Lakebase with history in Delta tables in one query.
  • Analytics across databases: Query and join tables from several registered Lakebase databases, including databases in different projects.
  • Replacing analytics-only pipelines: Query the current state of Lakebase tables directly instead of copying them into Delta with a change data capture (CDC) pipeline.

Data is queryable as soon as the transaction commits, so there's no CDC pipeline or sync job to run and no second copy of the data to govern. The query runs on Lakehouse//RT compute and doesn't compete with your transactional workload for Postgres compute. Each query reads a transactionally consistent snapshot of the Lakebase tables it references.

The following table compares Lakehouse//RT on Lakebase with other ways to use Lakebase data in the lakehouse:

Feature

How it reads Lakebase data

Use it for

Lakehouse//RT on Lakebase

Reads Lakebase storage directly, on Lakehouse//RT compute.

Analytics on live Lakebase data, alone or joined with Delta tables.

Serverless SQL warehouse on a registered catalog

Sends the query to Lakebase, which runs it on Postgres compute.

Occasional, light queries.

Lakebase Change Data Feed

Copies row-level changes into Unity Catalog managed Delta tables.

Change history, audit, downstream pipelines, and engines other than Lakehouse//RT.

Synced tables

Copies lakehouse data into Lakebase. Data flows the other way.

Serving lakehouse data to applications at low latency.

Feature

How it reads Lakebase data

Use it for

Lakehouse//RT on Lakebase

Reads Lakebase storage directly, on Lakehouse//RT compute.

Analytics on live Lakebase data, alone or joined with Delta tables.

Serverless SQL warehouse on a registered catalog

Sends the query to Lakebase, which runs it on Postgres compute.

Occasional, light queries.

Lakebase Change Data Feed

Copies row-level changes into Unity Catalog managed Delta tables.

Change history, audit, downstream pipelines, and engines other than Lakehouse//RT.

Synced tables

Copies lakehouse data into Lakebase. Data flows the other way.

Serving lakehouse data to applications at low latency.

For how this capability fits the Lakebase storage architecture, see LTAP architecture.

How Lakehouse//RT reads Lakebase data​

When you run a query on a Lakehouse//RT warehouse that references a registered Lakebase table:

  1. Unity Catalog resolves the table name and checks your Unity Catalog privileges.
  2. Lakehouse//RT asks the Lakebase primary compute for a consistent snapshot of the committed transactions. This lightweight metadata lookup is the only work the Postgres compute does for the query.
  3. Lakehouse//RT reads the table data directly from Lakebase storage and applies Postgres multi-version concurrency control (MVCC) visibility rules, so the query sees only the transactions committed as part of the snapshot.
  4. Lakehouse//RT runs the query on its own compute and joins Delta tables if the query references them.

A query sees every transaction committed before it starts, with no replication lag or sync interval. Each query reads one snapshot across all the Lakebase tables it references, with Read Committed semantics, so it never sees in-flight transactions or uncommitted data (dirty reads). UPDATE and DELETE statements behave the same as for any Postgres reader: the query sees the current committed version of each row, and deleted rows are gone. Delta tables in the same query are read at their latest version.

Lakehouse//RT runs queries with Databricks SQL semantics, not Postgres semantics. When you use Lakehouse//RT, you must write queries in Databricks SQL syntax. Postgres-specific functions and operators might not work, and results can differ from Postgres in edge cases. For the SQL that Lakehouse//RT supports, see Prepare your workloads for Lakehouse//RT.

Prerequisites​

  • Your workspace is enrolled in the Lakehouse//RT on Lakebase Beta. Contact your Databricks account team to enroll.
  • Lakehouse//RT is enabled in your workspace. See Lakehouse Real-Time.
  • A Lakebase project with a database on Postgres 16, 17, or 18.
  • CREATE CATALOG privileges on the Unity Catalog metastore, to register the database.
  • A Postgres role in the Lakebase project for the person who sets up the catalog. Everyone who runs analytics needs a Databricks identity with access in Unity Catalog.

Set up Lakehouse//RT on Lakebase​

To set up Lakehouse//RT on Lakebase:

  1. Go to Compute > SQL Warehouses > Create SQL Warehouse.

  2. Select Real-Time, choose a Query size, set Autoscaling and Auto stop, enter a name, and click Create. For sizing guidance, see Create a Lakehouse//RT warehouse.

  3. Grant Can use on the warehouse to the users and groups who run analytics. See SQL warehouse ACLs.

  4. Use the app switcher to go to Analytics and AI.

  5. In Catalog Explorer, click the plus button and Create a catalog.

  6. Enter a catalog name, such as lakebase_app.

  7. Select Lakebase Postgres as the catalog type, then select the Autoscaling option.

  8. Select your project, branch, and Postgres database, and click Create.

    For other ways to register a database, such as the API or SDK, see Register a Lakebase database in Unity Catalog.

  9. Open the SQL editor attached to a serverless SQL warehouse, and grant Unity Catalog access on the catalog. Lakehouse//RT doesn't run GRANT statements. For example, to give the analysts group read access to the lakebase_app catalog, run the following:

    SQL
    GRANT USE CATALOG ON CATALOG lakebase_app TO `analysts`;
    GRANT SELECT ON CATALOG lakebase_app TO `analysts`;

The catalog appears in Catalog Explorer with your database's schemas and tables, and the users you granted access can query it from the Real-Time warehouse.

Finalize your table schemas before you register the database. A database can be registered in only one catalog, and re-registering it resets the Unity Catalog grants on the catalog.

Query Lakebase tables​

In the SQL editor, a notebook, or an AI/BI dashboard, select your Real-Time warehouse in the compute picker, and refer to tables by their three-part name. For example, to summarize the last day of orders, run the following:

SQL
SELECT status, count(*) AS orders, sum(amount) AS revenue
FROM lakebase_app.public.orders
WHERE created_at >= current_date() - INTERVAL 1 DAY
GROUP BY ALL;

To confirm that results are live, insert a row into the table from your application or the Lakebase SQL editor, then run the query again. The new row appears in the results.

You can join Lakebase tables with Delta tables, and with tables in other registered Lakebase catalogs, in the same query. For example, to join live orders in Lakebase with customer data in a Delta table, run the following:

SQL
SELECT o.order_id, o.status, o.amount, c.segment
FROM lakebase_app.public.orders AS o
JOIN main.crm.customers AS c ON o.customer_id = c.customer_id
WHERE o.created_at >= current_date() - INTERVAL 7 DAYS;

If the query returns results on a Real-Time warehouse, it read Lakebase storage directly. Lakehouse//RT doesn't fall back to another query path. A query that uses an unsupported feature fails with an error that names the feature.

To connect an application or BI tool directly, use a driver configured for Lakehouse//RT. See Connectivity. If you call the Statement Execution API, a Real-Time warehouse returns results in ARROW_STREAM format by default. To get JSON rows, set format to JSON_ARRAY.

Query a partitioned table​

Lakehouse//RT can read the individual partitions of a partitioned table, but not the partitioned parent table. To query a partitioned table as one table, create a Unity Catalog view that combines its partitions. For example, to combine two monthly partitions of an events table, run the following on a serverless SQL warehouse:

SQL
CREATE VIEW main.analytics.events AS
SELECT * FROM lakebase_app.public.events_2026_10
UNION ALL
SELECT * FROM lakebase_app.public.events_2026_11;

Then query the view from your Real-Time warehouse.

Access control for Lakebase tables​

Unity Catalog controls access to Lakebase tables queried through Lakehouse//RT. Users need USE CATALOG, USE SCHEMA, and SELECT on the registered table.

  • Postgres privileges: Privileges defined natively in Postgres don't apply on this path. A Postgres GRANT doesn't give anyone access through Lakehouse//RT, and a Postgres REVOKE doesn't remove it. Applications that connect to Postgres still use Postgres roles and privileges. Define access for Lakehouse//RT in Unity Catalog and application access in Postgres.
  • Row-level security: Queries on tables that have Postgres row-level security enabled fail with an error. Queries on tables with column-level Postgres privileges also fail.
  • Unity Catalog policies: Attribute-based access control (ABAC) policies defined on the registered catalog apply to its Lakebase tables. See Attribute-based access control in Unity Catalog. You can't assign row filters or column masks directly to Lakebase tables.

For more about registered catalog permissions, see Permissions and access control.

Supported data types​

Lakehouse//RT reads the following Postgres data types:

Category

Postgres types

Numeric

smallint, integer, bigint, real, double precision, and numeric(p,s) with a precision of 38 or less

Text

text, varchar, and json (read as STRING)

Date and time

date, timestamp, timestamptz

Other

boolean, uuid, bytea (read as BINARY)

Category

Postgres types

Numeric

smallint, integer, bigint, real, double precision, and numeric(p,s) with a precision of 38 or less

Text

text, varchar, and json (read as STRING)

Date and time

date, timestamp, timestamptz

Other

boolean, uuid, bytea (read as BINARY)

If a table has a column of an unsupported type, queries on that table fail, even when the query doesn't reference the column. Unsupported types include jsonb, arrays, interval, enums, xml, unbounded numeric, and extension types such as vector.

Limitations​

Lakehouse//RT on Lakebase is read-only. To write data to Lakebase, use Lakebase directly.

Postgres versions: Databases must run Postgres 16, 17, or 18.

Object types: Lakehouse//RT reads regular tables, individual partitions, and populated materialized views. It doesn't read the following:

  • Views. Query the underlying tables instead.
  • Partitioned parent tables. Query the partitions, or create a Unity Catalog view over them. See Query a partitioned table.
  • Inheritance parent tables, foreign tables, sequences, and unpopulated materialized views.
  • Unlogged tables.
  • Synced tables. Unity Catalog registers a synced table as a foreign table, so queries fail with UNSUPPORTED_FEATURE.FOREIGN_TABLE. Query the source Unity Catalog table instead.

Table and column properties: Queries fail on tables with any of the following:

  • Postgres row-level security enabled, or column-level privileges.
  • Virtual generated columns.
  • Text columns that use a collation other than a byte-order collation, such as C.
  • Column names that differ only in case, such as the quoted identifiers "aBc" and "Abc".
  • Columns of an unsupported data type. See Supported data types.

Branches: Lakehouse//RT reads only the database that's registered in Unity Catalog, usually on your production branch. You can't register a child branch's database as a separate catalog.

Size and performance: Lakehouse//RT on Lakebase is optimized for Lakebase projects up to 1 TB. Lakehouse//RT doesn't use Postgres indexes, so each query scans the tables it reads. Use Lakebase directly for indexed point lookups.

Tools and compute: Genie and Jobs don't support Lakehouse//RT. The Lakebase SQL editor, Lakebase APIs, and Postgres clients run on Lakebase compute. Other SQL warehouses query a registered Lakebase catalog on Lakebase compute. For the tools that work with Lakehouse//RT, see Tools and interfaces.

Metadata refresh: Unity Catalog caches Lakebase metadata, so a newly registered catalog, new tables, and schema changes can take time to appear. Until they do, Lakehouse//RT queries fail with TABLE_OR_VIEW_NOT_FOUND. See Troubleshooting. Changes to the data in existing tables are visible right away.

Networking and compliance: Lakehouse//RT on Lakebase supports Private Link. It supports the compliance security profile standards that both Lakehouse//RT and Lakebase support. See Data protection.

Troubleshooting​

The following table lists common errors and how to resolve them:

Error

Cause

Resolution

UNSUPPORTED_FEATURE with the detail Lakebase support is not yet enabled for this SQL warehouse

Your workspace isn't enrolled in the Lakehouse//RT on Lakebase Beta.

Contact your Databricks account team.

TABLE_OR_VIEW_NOT_FOUND for a table that exists in Lakebase

Unity Catalog hasn't loaded the table's metadata since you registered the catalog or created the table.

In Catalog Explorer, open the catalog and click Refresh Schema Icon, or query the table one time from a serverless SQL warehouse. Then run the query again from the Real-Time warehouse.

UNSUPPORTED_FEATURE.LAKEBASE_COLUMN_TYPE or UNSUPPORTED_FEATURE.LAKEBASE_NUMERIC_TYPE_MODIFIER

The table has a column of an unsupported type, or a numeric column without a declared precision and scale.

See Supported data types.

UNSUPPORTED_FEATURE.LAKEBASE_RELATION_KIND or UNSUPPORTED_FEATURE.LAKEBASE_TABLE_PROPERTY

The query references an unsupported object type or a table with an unsupported property, such as row-level security.

See Limitations.

UNSUPPORTED_FEATURE.LAKEBASE_SERVER_VERSION

The database runs an unsupported Postgres version.

Use a database on Postgres 16, 17, or 18.

UNSUPPORTED_FEATURE.FOREIGN_TABLE for a synced table

Lakehouse//RT doesn't read synced tables.

Query the synced table's source Unity Catalog table instead.

Error

Cause

Resolution

UNSUPPORTED_FEATURE with the detail Lakebase support is not yet enabled for this SQL warehouse

Your workspace isn't enrolled in the Lakehouse//RT on Lakebase Beta.

Contact your Databricks account team.

TABLE_OR_VIEW_NOT_FOUND for a table that exists in Lakebase

Unity Catalog hasn't loaded the table's metadata since you registered the catalog or created the table.

In Catalog Explorer, open the catalog and click Refresh Schema Icon, or query the table one time from a serverless SQL warehouse. Then run the query again from the Real-Time warehouse.

UNSUPPORTED_FEATURE.LAKEBASE_COLUMN_TYPE or UNSUPPORTED_FEATURE.LAKEBASE_NUMERIC_TYPE_MODIFIER

The table has a column of an unsupported type, or a numeric column without a declared precision and scale.

See Supported data types.

UNSUPPORTED_FEATURE.LAKEBASE_RELATION_KIND or UNSUPPORTED_FEATURE.LAKEBASE_TABLE_PROPERTY

The query references an unsupported object type or a table with an unsupported property, such as row-level security.

See Limitations.

UNSUPPORTED_FEATURE.LAKEBASE_SERVER_VERSION

The database runs an unsupported Postgres version.

Use a database on Postgres 16, 17, or 18.

UNSUPPORTED_FEATURE.FOREIGN_TABLE for a synced table

Lakehouse//RT doesn't read synced tables.

Query the synced table's source Unity Catalog table instead.

For errors that aren't specific to Lakebase, see Troubleshooting for Lakehouse//RT.

Additional resources​