Skip to main content

Read Bauplan tables from other engines

Every Bauplan table is an Iceberg table stored in your bucket. Other engines can read it in place, without copying it. Engines that support Iceberg REST catalogs connect at the catalog level. Other engines register each table at the table level.

  1. Catalog level. The engine attaches to Bauplan's Iceberg REST catalog and sees every namespace and table, always at their latest state.
  2. Table level. You register each table in the engine from its Iceberg metadata file, and register it again when the table changes.

Give the engine access to the bucket

In both cases, the engine reads the data files directly from your bucket. Give it read-only access to the bucket that holds your Bauplan tables. Bauplan must be the only writer of its managed tables.

Connect at the catalog level

The catalog URL includes the branch to read. Without a branch, the engine reads main:

https://api.use1.aprod.bauplanlabs.com/iceberg (main)
https://api.use1.aprod.bauplanlabs.com/iceberg/<username>.<branch> (another branch)

Authenticate with a Bauplan API key as a bearer token. Use the key of a user with the reader role. If it leaks, nobody can use it to change a table. With PyIceberg:

from pyiceberg.catalog import load_catalog

catalog = load_catalog(
"bauplan",
type="rest",
uri="https://api.use1.aprod.bauplanlabs.com/iceberg",
token="<api_key>",
)

revenue = catalog.load_table(("analytics", "customer_revenue")).scan().to_arrow()

Other engines take the same URL and token in their own catalog configuration.

Connect at the table level

For an engine without Iceberg REST support, get the location of the table's current metadata file and register the table from it:

import bauplan

client = bauplan.Client()

table = client.get_table(table="customer_revenue", ref="main", namespace="analytics")
print(table.metadata_location)

Each merge into main writes a new metadata file, and a table registered this way stays at the snapshot it was registered from. Register it again after every merge, for instance as the last step of the job that merges.

A model with the REPLACE materialization strategy drops the table and creates a new one on every run. An engine that refreshes a table it already registered could reject the new metadata file as belonging to a different table. Register the table again after each run instead of refreshing it, or write it with a different strategy. The strategies are compared in how to materialize pipeline outputs. Engines connected at the catalog level look up the table by name, and see the new table without any extra step.