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:
- Reading DuckLake metadata - Extracts table schemas, file paths, and snapshot information
- Creating Delta checkpoint files - Generates
.checkpoint.parquetfiles with Delta Lake metadata - Writing JSON transaction logs - Creates minimal
.jsonlog files for Spark compatibility - 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.
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ducklake_delta_exporter-0.3.0.tar.gz | 13.7 kB | Without provenance | Details for ducklake_delta_exporter-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ducklake_delta_exporter-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for ducklake_delta_exporter-0.3.0-py3-none-any.whl |
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
|
Security for ducklake-delta-exporter 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.