Skip to main content

DuckLake Delta Exporter

A Python package for exporting DuckLake snapshots as Delta Lake checkpoint files, enabling compatibility with Delta Lake readers, support local path, s3 and gcs, for onelake use mounted storage as azure storage is not supported

this is just a fun project, please vote for a proper support in duckdb https://github.com/duckdb/duckdb-delta/issues/218

Repository

https://github.com/djouallah/ducklake_delta_exporter

Installation

pip install ducklake-delta-exporter

Usage

from ducklake_delta_exporter import generate_latest_delta_log

# Export all tables from a DuckLake database
generate_latest_delta_log("/path/to/ducklake.db")

# Specify a custom data root directory
generate_latest_delta_log("/path/to/ducklake.db", data_root="/custom/data/path")

What it does

This package converts DuckLake table snapshots into Delta Lake format by:

  1. Reading DuckLake metadata - Extracts table schemas, file paths, and snapshot information
  2. Creating Delta checkpoint files - Generates .checkpoint.parquet files with Delta Lake metadata
  3. Writing JSON transaction logs - Creates minimal .json log files for Spark compatibility
  4. Mapping data types - Converts DuckDB types to Spark SQL equivalents

Features

  • Spark Compatible - Generated Delta files can be read by Spark and other Delta Lake tools
  • Type Mapping - Automatic conversion between DuckDB and Spark data types
  • Batch Processing - Exports all tables in a DuckLake database
  • Error Handling - Graceful handling of missing snapshots and other issues
  • Progress Reporting - Clear feedback on export progress and results

Requirements

  • Python 3.8+
  • DuckDB

File Structure

After running the exporter, your Delta tables will have the following structure:

your_table/
├── data_file_1.parquet
├── data_file_2.parquet
└── _delta_log/
    ├── 00000000000000000000.json
    ├── 00000000000000000000.checkpoint.parquet
    └── _last_checkpoint

Type Mapping

The exporter automatically maps DuckDB types to Spark SQL types:

DuckDB Type Spark Type
INTEGER integer
BIGINT long
FLOAT double
DOUBLE double
DECIMAL decimal(10,0)
BOOLEAN boolean
TIMESTAMP timestamp
DATE date
VARCHAR string
Others string

Error Handling

The exporter handles various error conditions:

  • Missing snapshots - Skips tables with no data
  • Existing checkpoints - Avoids overwriting existing files
  • Schema changes - Uses the latest schema for each table
  • File system errors - Reports and continues with other tables

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Release files for ducklake-delta-exporter 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ducklake-delta-exporter 0.3.0
File Size Uploaded
ducklake_delta_exporter-0.3.0.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ducklake-delta-exporter 0.3.0
File Interpreter ABI Platform
ducklake_delta_exporter-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / ducklake_delta_exporter-0.3.0.tar.gz

Download URL ducklake_delta_exporter-0.3.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
acf06d9ddf36eb8ebc91514fe6d8957268a34057f2f68e2bf578303392c0ad77
BLAKE2b-256 checksum
How to use checksums
ab7ae5da66febb8ed2400cd5e3f895a1067ce2c4debb06046f0ba4a1f27fbc92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / ducklake_delta_exporter-0.3.0-py3-none-any.whl

Download URL ducklake_delta_exporter-0.3.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb6ff1377a2638fbeab0bae1a60c161aa2ac41eb7ba0e232b15741b1f99a340a
BLAKE2b-256 checksum
How to use checksums
fd3ecc64c1f4cedfece26f6a7a31d7959b2ef24c9bd64f1fe5727eb4184ee73b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page