Skip to content
Live
Databricks Blog·· 2 hours ago45

How to read Unity Catalog Iceberg tables on GCP

How to read Unity Catalog Iceberg tables on GCP

Brief overview

Open source Apache Spark on GCP Dataproc can read and write Unity Catalog managed Iceberg tables through the Iceberg REST API without Databricks libraries.

Article

Unity Catalog managed Iceberg tables are standard Apache Iceberg metadata and Parquet files stored in your own Google Cloud Storage (GCS) bucket on Google Cloud Platform (GCP). Open source Apache Spark on GCP Dataproc can read and write them through the Iceberg REST API with no Databricks libraries, and the same files can be registered into any other Iceberg catalog, such as a Hive metastore, for portable read-only access. This walkthrough demonstrates both paths end to end, with runnable scripts, on a plain Dataproc cluster.

This walkthrough takes an existing Unity Catalog-managed Iceberg table and works with it from plain open source Apache Spark™ on Dataproc, with nothing Databricks-specific installed on the cluster, in two ways:

  1. Through the Iceberg REST API. Unity Catalog implements the open Apache Iceberg™ REST Catalog specification. Spark on Dataproc connects to it exactly as it would to any other Iceberg REST catalog, reads the table, creates a new one and writes rows that Databricks sees immediately.
  2. By registering the same table in a Hive catalog. The table's metadata.json lives in your own GCS bucket. The file is registered in the Dataproc Hive metastore with Iceberg's standard register_table procedure and queried through Spark's Hive catalog, demonstrating that the data is portable to any Iceberg-capable catalog. This second path is shown only to demonstrate portability; in production, keep each table owned by a single catalog.

Along the way, the blog notes where each path fits, and one behaviour of the Hive path that is worth understanding before you rely on it. The complete, runnable scripts for every step are in this GitHub repository.

What makes Unity Catalog Iceberg tables open and portable?

Three layers make this work, and none of them is proprietary.

  1. Open format. A managed Iceberg table in Unity Catalog is created with USING ICEBERG and stored as Apache Iceberg metadata (metadata.json, manifest lists, manifests) plus Parquet data files. They sit in a GCS bucket in your own Google Cloud project, under the catalog or schema's managed storage location. Nothing in those files requires Databricks to read them.
  2. Open catalog API. Unity Catalog exposes the tables through its implementation of the Iceberg REST Catalog spec at /api/2.1/unity-catalog/iceberg-rest. Any client built against that spec, including Spark, Trino, Flink, PyIceberg, Snowflake and Dremio, uses the same type=rest, uri, warehouse and token settings. The Spark configuration later in this blog contains no Databricks jar and no Databricks-specific property. Change the uri and warehouse and the same Dataproc job targets a different Iceberg REST catalog.
  3. Open credential vending. When Spark loads a table, Unity Catalog checks the caller's privileges and returns a short-lived GCS credential scoped to that table's location, following the standard Iceberg REST access-delegation flow. The Dataproc cluster needs no keys for the Unity Catalog bucket, and the Dataproc service account needs no access to it. Governance stays in one place.

apache spark on google cloud dataproc

How do you set up Unity Catalog for external Iceberg access?

This walkthrough assumes a Unity Catalog managed Iceberg table, uc_iceberg_demo.sales.orders. If you don't have one, create it in Databricks (SQL editor or notebook) first:

Then complete three one-time prerequisites, performed by a metastore admin or the table owner.

  1. First, enable external data access on the metastore. In the workspace this is under Catalog, Metastore details, External data access.
  2. Second, pick the identity Dataproc will use and create a credential for it. This walkthrough uses a personal access token (PAT) because it is the fastest route to a working session. For production, use a service principal with OAuth. There is a note on that under lessons learned.
  3. Third, grant the privileges. EXTERNAL USE SCHEMA is the one that permits Unity Catalog to vend storage credentials to an external engine.

Add MODIFY and CREATE TABLE on the schema if Dataproc will write or create tables.

How do you create a Dataproc cluster for Iceberg?

A single-node cluster on Dataproc image 2.3 is enough. Image 2.3 ships Spark 3.5 on Scala 2.12 as of November 2026, and those two versions decide which Iceberg runtime artifact you need.

The cluster has no external IP, so it needs an egress path such as Cloud NAT to reach Maven Central for the Iceberg jars and your Databricks workspace URL. The one-hour idle timeout tears it down automatically.

Export the workspace URL and token once so the later commands can reuse them.

How does open source Spark connect to the Iceberg REST API?

This is the entire configuration. Every property is a standard Apache Iceberg REST catalog property.

What each line does:

  • iceberg-spark-runtime-3.5_2.12 and iceberg-gcp-bundle are the stock Apache Iceberg artifacts from Maven Central. Version 1.10.0 was the latest stable release at the time of writing (November 2026). The runtime must match the Spark and Scala versions on the image, and both artifacts must be the same Iceberg version. The GCP bundle provides GCSFileIO; without it Spark reaches the catalog but cannot open files in GCS, and the error is a class-not-found rather than a permission error.
  • type=rest and uri point the standard Iceberg REST client at Unity Catalog. Pointing it at any other Iceberg REST catalog is a one-line change.
  • warehouse is the Unity Catalog catalog name. The Spark alias uc is arbitrary, so uc.sales.orders in Spark is uc_iceberg_demo.sales.orders in Databricks.

There are no GCS credentials. Unity Catalog vends them per table.

Can Dataproc read and write Unity Catalog Iceberg tables?

Reading an existing table is one job submission.

Creating and populating a new table from Dataproc works the same way.

The table that appears in Databricks is an ordinary Unity Catalog managed Iceberg table. It shows up in Catalog Explorer, it is queryable as uc_iceberg_demo.sales.my_orders from a SQL warehouse straight away, and Unity Catalog privileges, lineage and audit apply to it. Nothing marks it as "created externally". The commit went through the REST API, so Unity Catalog's pointer to the current metadata.json moved, and both engines agree on the table state.

How do you register a Unity Catalog Iceberg table in Hive?

Now the portability demonstration. The REST API is not the only way to reach these files. Because the table is standard Iceberg in your own bucket, any Iceberg catalog can take its current metadata.json and register it. This example uses the Hive metastore that ships with Dataproc, which is what many teams with existing Hive-based Spark tooling already run.

Note: for demonstration only. This step registers a table that Unity Catalog still manages in a second catalog, purely to show that the files are portable. In production, a table should have exactly one owning catalog: Apache Iceberg's register_table documentation warns that registering the same metadata.json in more than one catalog can lead to missing updates, data loss and table corruption. Treat the registration below as a temporary, read-only view, and don't write through it. To actually move a table to another catalog, unregister it from Unity Catalog first and then register it in the destination (UNREGISTER → REGISTER), so only one catalog ever owns it. UNREGISTER is in Private Preview as of November 2026.

Set up a second properties file for a Hive-backed Iceberg catalog. Only the Iceberg runtime jar is needed. On this path there is no credential vending, so the Dataproc service account needs its own read access to the bucket that holds the table.

Find the table's current metadata file. The standard Iceberg REST loadTable response carries it in metadata-location, so one curl call is enough. You could equally list the table's metadata folder in GCS.

Create a Hive namespace, register the file, and query the table through the Hive catalog.

The count matches Databricks. The same bytes in GCS are now visible to two independent catalogs, one of which has never heard of Databricks.

Why does a Hive-registered Iceberg table go stale?

A registration points at one specific metadata.json. Every Databricks write (INSERT, MERGE, UPDATE, DELETE and maintenance such as OPTIMIZE) commits a new metadata file in Unity Catalog, but the Hive entry keeps pointing at the old one. From that moment the two catalogs disagree about the table, and nothing brings them back in step automatically. To pick up new data, fetch the new location and re-register.

Insert in Databricks, for example from the SQL editor.

Confirm the Hive side still shows the old count, then fetch the new metadata location. The file name now ends in a higher sequence number.

Drop the registration without PURGE and register the new file. Then verify that the count includes the new rows and the snapshot history shows the Databricks commit.

In production, make the fetch and re-register the last task of the Databricks job that loads the table, or run it on a schedule. Between refreshes, Dataproc reads the last registered version.

DROP TABLE without PURGE removes only the Hive metastore entry; the files in GCS are untouched and the table can be registered again at any time. DROP TABLE ... PURGE would delete the data files, and those belong to the Databricks table. Never use PURGE on a registered Unity Catalog table.

Run this on Dataproc against the Hive catalog. In Databricks, DROP TABLE on a Unity Catalog managed table drops the table itself, which would remove the source table this registration points to.

What this costs in practice: stale reads between refreshes, with no warning to Dataproc users; a refresh job that must run after every load and fails silently if skipped; and fragility, since a write through the registration diverges from Databricks. The REST API path removes the problem, because Spark asks Unity Catalog for the current metadata on every query.

What happens if you write through a Hive-registered table?

A common question is whether you can write through the registered table. An INSERT through the Hive-registered table succeeds and the Hive catalog returns the new row. Databricks does not. This is standard Iceberg behaviour, not a Unity Catalog quirk: the Hive commit writes a new metadata.json and moves the Hive metastore pointer, and Unity Catalog's pointer, which is the only one Databricks consults, is unaware of it. The two catalogs now hold diverging histories of the same table, the split-brain scenario described in “Unlocking Data Portability: Preventing Catalog Lock-in with REGISTER and UNREGISTER APIs”. The Apache Iceberg documentation for register_table warns about exactly this, which is why Step 5 treats the registration as a read-only demo.

So the two paths have different jobs. The REST API path is a shared catalog: every commit, from Databricks or from Dataproc, moves the same pointer, and that is why writes through it are safe. The Hive registration is a portable read-only view of a point in time. Use it for reads from Hive-based tooling, refresh it as shown above, and send writes through the REST API or Databricks.

When should you use the REST API vs. Hive registration?

 Iceberg REST API (Unity Catalog)Hive catalog registration
DemonstratesOpen catalog API: standard REST client, no Databricks librariesOpen format: standard Iceberg files usable by any catalog
ReadsYes, always currentYes, as of the registered metadata.json
Writes from DataprocYes, visible in Databricks immediatelyNot recommended; forks the table history
Storage credentials on DataprocNone, vended per table by Unity CatalogService account needs read access to the bucket
Unity Catalog governanceApplied on every callOnly at registration time
Refresh after Databricks writesAutomaticFetch new metadata.json and re-register
Good forAny read or write workloadShort-lived, read-only demos of portability; for a real move, use UNREGISTER → REGISTER

What are the common pitfalls with Iceberg on GCP Dataproc?

The configuration is standard Apache Iceberg. The Dataproc side needs no Databricks-specific libraries or settings. The REST catalog properties are documented by Apache Iceberg, and the Hive registration uses Iceberg's standard register_table procedure.

Match jar versions to the Dataproc image. Classpath mismatches often look like connectivity or permission errors. Check the Spark and Scala versions on the image and use the matching iceberg-spark-runtime artifact.

Use a service principal for anything scheduled. PATs are convenient for a walkthrough but are legacy for production. The Iceberg REST client supports OAuth client credentials directly: replace token with rest.auth.type=oauth2, oauth2-server-uri, credential and scope=all-apis.

Know the external-write limitations on the REST path. As of this writing, external clients cannot run table maintenance such as snapshot expiry or orphan file removal. On Iceberg v3 tables, row-level changes from external engines must use copy-on-write or deletion vectors.

Unity Catalog managed Iceberg tables are open at every layer that matters: open files in your own bucket, an open catalog API, and standard credential vending. Plain open source Spark on Google Cloud Dataproc read and wrote them through the Iceberg REST API with a generic configuration, and the same files were registered into a Hive catalog with no Databricks involvement. The practical rule that falls out is simple: use the shared REST API for anything that writes, and treat a registration in another catalog as a portable read-only view you refresh on your own schedule.

Ready to try it on your own tables?

Start with the Databricks documentation on accessing tables from Apache Iceberg clients and the overview of Apache Iceberg in Databricks. If you are evaluating Iceberg v3 features such as deletion vectors and row lineage, see Iceberg v3 on Databricks. For the same openness story from other engines, see the Community blogs on Apache Spark via Open APIs and Trino via Open APIs. The complete code for this walkthrough is in the companion GitHub repository. 

FAQs

Are Unity Catalog managed Iceberg tables locked to Databricks?

No, Unity Catalog managed Iceberg tables are not locked to Databricks. They are standard Apache Iceberg metadata and Parquet files stored in a GCS bucket in your own Google Cloud project. Any client that implements the open Iceberg REST Catalog spec can read and write them, and the same files can be registered into another Iceberg catalog, such as a Hive metastore, with Iceberg's standard register_table procedure.

Does open source Spark on Dataproc need any Databricks libraries to use Unity Catalog?

No, open source Spark on Dataproc does not need any Databricks libraries to query Unity Catalog Iceberg tables. The configuration uses only the Apache Iceberg Spark runtime and the Iceberg GCP bundle from Maven Central, with the standard type=rest, uri, warehouse and token properties. Changing the uri and warehouse points the same job at a different Iceberg REST catalog.

Does Dataproc need credentials for the Google Cloud Storage bucket behind the table?

On the REST API path, Dataproc does not need any GCS credentials for the table's bucket. Unity Catalog vends short-lived, table-scoped GCS credentials to the Iceberg client on each table load, provided the identity has EXTERNAL USE SCHEMA on the schema. The Hive registration path has no credential vending, so there the Dataproc service account needs its own read access to the bucket.

Why does Databricks not see rows written through a Hive metastore registered table?

Because the Hive commit moves only the Hive metastore's pointer to a new metadata.json. Unity Catalog keeps its own pointer and was never told about the commit, so Databricks continues reading the previous version. Send writes through the REST API, where every commit moves the shared Unity Catalog pointer, and treat the Hive registration as read-only.

How do I see new Databricks data in a Hive metastore registered table?

Fetch the latest metadata-location from the REST loadTable endpoint, drop the registered table without PURGE, and call register_table again with the new file. Automate this as the final step of the Databricks job that loads the table.

Related Databricks Blogs

Related Community Technical Blogs (same series of external-engine walkthroughs):

Source: Databricks Blog · databricks.com