On this page:

Iceberg Java API

You can access Iceberg tables in Tabular natively using the Iceberg Java API, without the need for an execution engine like Spark, Trino, or Flink. This is useful if you don’t have an execution engine available or you need lower level access to the API. You can read more about the Iceberg Java API in the official Iceberg docs.

Programmatic Configuration

You can create an Iceberg catalog programmatically to access a Tabular warehouse, e.g.:

Map<String, String> catalogProps = Map.of(
    "uri", "",
    "credential", "<your-tabular-credential>",
    "warehouse", "<your-warehouse-name>"
try (Catalog catalog = new RESTCatalog()) {
    catalog.initialize("iceberg", catalogProps);
    Table table = catalog.loadTable(TableIdentifier.parse("<db>.<table>"));

Access in Spark

If you are running an application in Spark, but need direct access to the Iceberg Java API, Iceberg provides the utility class org.apache.iceberg.spark.Spark3Util to get a reference to the Iceberg catalog from the Spark session, e.g.:

Catalog catalog =
    Spark3Util.loadIcebergCatalog(sparkSession, "<catalog name>")

You can also load a table directly without first getting the catalog, e.g.:

Table table =
    Spark3Util.loadIcebergTable(sparkSession, "<catalog>.<db>.<table>")

See the docs on configuring Spark to work with Tabular for more information.

Blog Posts

Read more about using the Iceberg Java API in our series of blog posts: