Skip to main content

zerodb-prefect

ZeroDB event sensor and result storage for Prefect.

PyPI License: MIT

Why use this?

Feature Description
Event sensor ZeroDB events trigger Prefect flows automatically
Result storage Store and retrieve flow results in ZeroDB tables
Auto-provision No signup needed -- ZeroDB project created on first use
Webhook + polling Two modes: poll event stream or receive webhooks
Credentials block Manage API keys with the ZeroDBCredentials class

Installation

pip install zerodb-prefect

Quick Start

Event Sensor

from zerodb_prefect import ZeroDBSensor

sensor = ZeroDBSensor(event_type='zerodb.vector.stored')

@sensor.on_event
def process_vector(event):
    print(f"New vector: {event.data}")
    return {'processed': event.data['vector_id']}

# Start polling for events
sensor.start()

Result Storage

from zerodb_prefect import ZeroDBBlock

block = ZeroDBBlock()

# Write results
block.write_path('/results/my-flow/run-1', {
    'status': 'complete',
    'rows_processed': 42,
})

# Read results
data = block.read_path('/results/my-flow/run-1')
print(data)  # {'status': 'complete', 'rows_processed': 42}

Credentials

from zerodb_prefect import ZeroDBCredentials

creds = ZeroDBCredentials(api_key='zdb_...', project_id='proj_...')
client = creds.get_client()  # Authenticated requests.Session

API Reference

ZeroDBSensor(event_type, **kwargs)

Poll ZeroDB events and trigger handlers.

Param Default Description
event_type required Event type to listen for
api_key auto ZeroDB API key
project_id auto ZeroDB project ID
poll_interval 5 Seconds between polls
batch_size 100 Max events per poll

Methods:

Method Description
@sensor.on_event Decorator to register handler
sensor.add_handler(func) Register handler (non-decorator)
sensor.poll() Manually poll for events
sensor.start() Start polling in background thread
sensor.stop() Stop polling
sensor.process_webhook(payload) Process webhook payload

ZeroDBBlock(**kwargs)

Store and retrieve Prefect flow results.

Method Description
write_path(path, content) Store content keyed by path
read_path(path) Read content by path
exists(path) Check if path exists
delete_path(path) Delete stored result
list_paths(prefix=None) List stored paths

ZeroDBCredentials(**kwargs)

Manage ZeroDB API credentials.

Method Description
get_client() Return authenticated requests.Session
get_headers() Return auth headers as dict

Configuration

Environment Variables

export ZERODB_API_KEY="your-api-key"
export ZERODB_PROJECT_ID="your-project-id"
# Optional
export ZERODB_BASE_URL="https://api.ainative.studio"

Auto-Provisioning

If no credentials are found, zerodb-prefect automatically creates a free ZeroDB project on first use. Credentials are saved to ~/.zerodb/config.json.

Use Cases

ML Pipeline Results

from zerodb_prefect import ZeroDBBlock

block = ZeroDBBlock()

# After training
block.write_path('/models/v2/metrics', {
    'accuracy': 0.94,
    'f1': 0.91,
    'training_time': 3600,
})

# In evaluation flow
metrics = block.read_path('/models/v2/metrics')

Event-Driven ETL

from zerodb_prefect import ZeroDBSensor, ZeroDBBlock

sensor = ZeroDBSensor(event_type='zerodb.file.uploaded')
block = ZeroDBBlock()

@sensor.on_event
def etl_pipeline(event):
    file_path = event.data.get('path')
    block.write_path(f'/etl/processed/{file_path}', {
        'source': file_path,
        'status': 'processed',
    })

sensor.start()

Powered by ZeroDB + AINative

Free database for AI agents. Auto-provisions in 200ms. No signup required.

Get started | Documentation | ZeroDB | GitHub

License

MIT

Metadata

Release files for zerodb-prefect 0.1.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 zerodb-prefect 0.1.0
File Size Uploaded Provenance
zerodb_prefect-0.1.0.tar.gz 15.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zerodb-prefect 0.1.0
File Interpreter ABI Platform
zerodb_prefect-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.4 kB

Release files / zerodb_prefect-0.1.0.tar.gz

Download URL zerodb_prefect-0.1.0.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ca5aed5f19a95de144c8fe351f8401ad8778e6e85a73b50ec35aedd4de00f58a
BLAKE2b-256 checksum
How to use checksums
7da39a81cc1a7639a0cd7cd955a1132a8732ad3a7f4a718752115a7255eff75f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / zerodb_prefect-0.1.0-py3-none-any.whl

Download URL zerodb_prefect-0.1.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0a32176899cc9d824adf82f1464a6983afa4150552879b06004aabbb1499c3a
BLAKE2b-256 checksum
How to use checksums
1897da516c65df63bd92d82094c422eac1537e8bf850dea731d1e23a71a66f61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for zerodb-prefect 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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