DuckDB compute plugin for the floe data platform
Project description
floe-compute-duckdb
DuckDB compute plugin for the floe data platform.
Overview
This plugin enables DuckDB as a compute target for dbt transforms in the floe platform. DuckDB is a self-hosted, in-process analytical database that runs within K8s job pods alongside dbt.
Features
- In-process: Runs alongside dbt in the same pod
- Self-hosted: Managed by floe K8s infrastructure
- Iceberg support: Direct catalog attachment via iceberg extension
- Low overhead: No separate database server required
Installation
pip install floe-compute-duckdb
Or with dbt adapter:
pip install floe-compute-duckdb[dbt]
Usage
The plugin is automatically discovered by the floe registry via entry points:
from floe_core.plugin_registry import get_registry
from floe_core.plugin_types import PluginType
registry = get_registry()
duckdb_plugin = registry.get(PluginType.COMPUTE, "duckdb")
print(f"Plugin: {duckdb_plugin.name} v{duckdb_plugin.version}")
Generate dbt Profile
from floe_core.plugins.compute import ComputeConfig
config = ComputeConfig(
extra={
"path": ":memory:",
"threads": 4,
"extensions": ["iceberg", "httpfs"],
"settings": {"memory_limit": "4GB"}
}
)
profile = duckdb_plugin.generate_dbt_profile(config)
# {'type': 'duckdb', 'path': ':memory:', 'threads': 4, ...}
Validate Connection
result = duckdb_plugin.validate_connection(config)
if result.success:
print(f"Connected in {result.latency_ms:.1f}ms")
else:
print(f"Failed: {result.message}")
Query Timeout Configuration
The plugin supports query timeout enforcement via the timeout_seconds configuration:
from floe_core import ComputeConfig
config = ComputeConfig(
plugin="duckdb",
threads=4,
timeout_seconds=300, # 5 minute timeout
connection={"path": ":memory:"}
)
profile = duckdb_plugin.generate_dbt_profile(config)
# profile["timeout_seconds"] == 300
How timeout enforcement works:
- The plugin includes
timeout_secondsin the generated dbt profile - The dbt-duckdb adapter is responsible for actual timeout enforcement
- Platform operators can set timeouts in
manifest.yamlto enforce governance - Data engineers inherit the platform default unless explicitly overridden
Default value: 3600 seconds (1 hour)
Valid range: 1 to 86400 seconds (1 second to 24 hours)
Get K8s Resource Requirements
spec = duckdb_plugin.get_resource_requirements("medium")
print(f"CPU: {spec.cpu_request} - {spec.cpu_limit}")
print(f"Memory: {spec.memory_request} - {spec.memory_limit}")
Development
# Install in development mode
uv pip install -e ".[dev]"
# Run tests
uv run pytest tests/unit/ -v
# Type checking
uv run mypy src/
# Linting
uv run ruff check src/
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file floe_compute_duckdb-0.1.0a1.tar.gz.
File metadata
- Download URL: floe_compute_duckdb-0.1.0a1.tar.gz
- Upload date:
- Size: 36.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30d56bb3843fb856c49feede7914b4f576705e4ab67b3cc40ae304f648434905
|
|
| MD5 |
bd60d5cb4797e48998f2db74000542ea
|
|
| BLAKE2b-256 |
0689945b193038a41c03241feb01b38aa8f56375f16fcdd02cfd80f5f16ffc09
|
File details
Details for the file floe_compute_duckdb-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: floe_compute_duckdb-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b542a1b6d9f9314a6234dddfe1ac1060cbf2a28276a574c175d2fb56b2874c6
|
|
| MD5 |
db4c5a20c0d6c76448ed3bba179c1ca0
|
|
| BLAKE2b-256 |
faf883815421cbb5f7efed568a82db0ea677928bdbc2a3d4ed54ef5c11179f4b
|