One copy of data, two catalogs, zero lock-in — open source Spark on GCP Dataproc reads and writes Unity Catalog Iceberg tables via the REST API
by Harika Mariyala and Saurav Bhowmick
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:
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.
Three layers make this work, and none of them is proprietary.
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./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.
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.
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.
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.
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.
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.
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.
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.
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.
| Iceberg REST API (Unity Catalog) | Hive catalog registration | |
|---|---|---|
| Demonstrates | Open catalog API: standard REST client, no Databricks libraries | Open format: standard Iceberg files usable by any catalog |
| Reads | Yes, always current | Yes, as of the registered metadata.json |
| Writes from Dataproc | Yes, visible in Databricks immediately | Not recommended; forks the table history |
| Storage credentials on Dataproc | None, vended per table by Unity Catalog | Service account needs read access to the bucket |
| Unity Catalog governance | Applied on every call | Only at registration time |
| Refresh after Databricks writes | Automatic | Fetch new metadata.json and re-register |
| Good for | Any read or write workload | Short-lived, read-only demos of portability; for a real move, use UNREGISTER → REGISTER |
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.
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.
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.
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.
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.
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.
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 Community Technical Blogs (same series of external-engine walkthroughs):
Subscribe to our blog and get the latest posts delivered to your inbox.