Clone
1
OLake Go Iceberg Integration
GAURI edited this page 2026-10-20 16:19:40 +05:30

OLake Go Iceberg Integration

OLake Go syncs data from supported sources to Iceberg destinations. This example uses PostgreSQL as the source and SeaweedFS as the Iceberg REST catalog and S3-compatible storage.

Prerequisites

  • OLake Go v0.12.3

Source and Destination Setup

OLake Go provides source-specific drivers and configurations for multiple connectors, including PostgreSQL, MongoDB, MySQL, Oracle, Kafka, DB2, S3, and Microsoft SQL Server (MSSQL). This walkthrough uses PostgreSQL.

Start SeaweedFS

docker volume create seaweed-data

docker run -d --name seaweedfs \
  -e AWS_ACCESS_KEY_ID=admin -e AWS_SECRET_ACCESS_KEY=password \
  -p 8333:8333 -p 8181:8181 -p 9333:9333 \
  -v seaweed-data:/data \
  chrislusf/seaweedfs:latest \
  mini -dir=/data -tableBucket=warehouse

PostgreSQL Source

To try a local setup, start the PostgreSQL source with CDC enabled. Download it with:

curl -fsSL https://raw.githubusercontent.com/datazip-inc/olake-docs/master/docs/community/docker-compose.yml \
  -o docker-compose.source.yml

To start the sample PostgreSQL database:

docker compose -f docker-compose.source.yml --profile postgres up -d

Once all the services are up, quickly check the sample data by running the below query:

docker exec -it primary_postgres psql -U main -d main -c "SELECT * FROM public.sample_data;"

Configure the PostgreSQL source in source.json:

{
  "host": "localhost",
  "port": 5431,
  "database": "main",
  "username": "main",
  "password": "password",
  "jdbc_url_params": {},
  "ssl": {
    "mode": "disable"
  },
  "update_method": {
    "replication_slot": "postgres_slot",
    "publication": "olake_publication",
    "initial_wait_time": 120
  },
  "reader_batch_size": 1000,
  "max_threads": 10
}

Iceberg Destination

Configure SeaweedFS as the Iceberg destination in destination.json:

{
  "type": "ICEBERG",
  "writer": {
    "catalog_type": "seaweedfs",
    "rest_catalog_url": "http://localhost:8181",
    "rest_auth_type": "OAuth2",
    "credential": "admin:password",
    "oauth2_uri": "http://localhost:8181/v1/oauth/tokens",
    "s3_endpoint": "http://localhost:8333",
    "iceberg_s3_path": "s3://warehouse",
    "aws_access_key": "admin",
    "aws_secret_key": "password",
    "aws_region": "us-east-1",
    "iceberg_db": "olake_iceberg",
    "catalog_name": "olake_iceberg"
  }
}

Sync PostgreSQL to Iceberg

Run these commands from the directory containing the PostgreSQL driver executable and the JSON configuration files. Discover the available PostgreSQL streams:

./build.sh driver-postgres discover --config $(pwd)/source.json

Discovery creates streams.json. Set the selected stream's sync_mode to the value for the strategy you want:

Sync mode What it does
full_refresh Copies the selected table's current contents on each run.
cdc Performs an initial full load, then captures inserts, updates, and deletes using CDC.
incremental Performs an initial full load, then reads new or changed rows using a cursor. It does not detect deletes.

Run the sync command:

./build.sh driver-postgres sync --config $(pwd)/source.json --catalog $(pwd)/streams.json --destination $(pwd)/destination.json

After the full refresh, run the next sync with state flag added to only capture the changes in source:

./build.sh driver-postgres sync --config $(pwd)/source.json --catalog $(pwd)/streams.json --destination $(pwd)/destination.json --state $(pwd)/state.json

See also

For more about OLake Go's sources, sync strategies, and Iceberg ingestion options, explore the OLake documentation.