Skip to main content

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:

  1. The plugin includes timeout_seconds in the generated dbt profile
  2. The dbt-duckdb adapter is responsible for actual timeout enforcement
  3. Platform operators can set timeouts in manifest.yaml to enforce governance
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

floe_compute_duckdb-0.1.0a1.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

floe_compute_duckdb-0.1.0a1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

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

Hashes for floe_compute_duckdb-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 30d56bb3843fb856c49feede7914b4f576705e4ab67b3cc40ae304f648434905
MD5 bd60d5cb4797e48998f2db74000542ea
BLAKE2b-256 0689945b193038a41c03241feb01b38aa8f56375f16fcdd02cfd80f5f16ffc09

See more details on using hashes here.

File details

Details for the file floe_compute_duckdb-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for floe_compute_duckdb-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b542a1b6d9f9314a6234dddfe1ac1060cbf2a28276a574c175d2fb56b2874c6
MD5 db4c5a20c0d6c76448ed3bba179c1ca0
BLAKE2b-256 faf883815421cbb5f7efed568a82db0ea677928bdbc2a3d4ed54ef5c11179f4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page