Skip to content

SQL Catalog

SqlCatalog implements the Iceberg Catalog API on top of a relational database. Its schema is compatible with the Apache Iceberg Java JdbcCatalog and stores catalog rows in iceberg_tables and iceberg_namespace_properties.

Build

The SQL catalog is currently available through the CMake build only. Meson does not build or install it yet.

Enable the catalog at configure time:

cmake -S . -B build -DICEBERG_BUILD_SQL_CATALOG=ON

Built-in connectors are optional:

CMake option Default Native dependency
ICEBERG_SQL_SQLITE OFF SQLite3
ICEBERG_SQL_POSTGRESQL OFF libpq
ICEBERG_SQL_MYSQL OFF libmysqlclient

The built-in connectors use sqlpp23, which is fetched by CMake when a connector is enabled. Projects can also supply their own CatalogStore implementation and disable all built-in connectors.

Usage

#include "iceberg/catalog/sql/sql_catalog.h"

using iceberg::sql::SqlCatalog;
using iceberg::sql::SqlCatalogConfig;

SqlCatalogConfig config{
    .name = "prod",
    .uri = "/var/lib/iceberg/catalog.db",
    .warehouse_location = "s3://my-bucket/warehouse",
};

auto catalog = SqlCatalog::MakeSqliteCatalog(config, file_io).value();

Connector factories are always declared in the public headers. If a connector was not built, its factory returns ErrorKind::kNotSupported.