Skip to main content

Official Python driver for the FluxDB C++ Database

Project description

# FluxDB Python Driver

![PyPI Version](https://img.shields.io/pypi/v/fluxdb-driver)
![License](https://img.shields.io/pypi/l/fluxdb-driver)
![Python](https://img.shields.io/pypi/pyversions/fluxdb-driver)

The official Python client for **FluxDB**, a high-performance, in-memory NoSQL database featuring adaptive indexing and real-time pub/sub capabilities.

## 🚀 Features

* **Hybrid Storage**: Combines in-memory speed with WAL (Write-Ahead Log) durability.
* **Adaptive Indexing**: Automatically creates Hash or B-Tree indexes based on your query patterns.
* **Real-Time Pub/Sub**: Built-in lightweight messaging system for event-driven apps.
* **Smart Querying**: Rich support for operators like `$gt`, `$lt`, `$ne`, and range queries.
* **Time-To-Live (TTL)**: Auto-expire documents for caching or temporary data.

## 📦 Installation

```bash
pip install fluxdb-driver

âš¡ Quick Start

Connecting

By default, FluxDB runs on localhost:8080.

from fluxdb import FluxDB

# Connect with authentication (default password: 'flux_admin')
db = FluxDB(host='127.0.0.1', port=8080, password='flux_admin')

# Create or switch to a database
db.use("game_data")

CRUD Operations

# 1. Insert a document
hero_id = db.insert({
    "username": "DragonSlayer",
    "level": 50,
    "inventory": ["sword", "shield"]
})
print(f"Created Hero ID: {hero_id}")

# 2. Find (Smart Query)
# Find players with level > 20
high_level_players = db.find({"level": {"$gt": 20}})

# 3. Update
db.update(hero_id, {"level": 51})

# 4. Get by ID
doc = db.get(hero_id)

# 5. Delete
db.delete(hero_id)

🧠 Advanced Features

Adaptive Indexing

Turn on adaptive mode to let the database optimize itself based on query misses.

db.toggle_adaptive(True)

Pub/Sub Messaging

FluxDB can act as a message broker.

def on_news(msg):
    print(f"Received: {msg}")

# Subscribe (Blocking)
# Run this in a separate thread or process
db.subscribe("news_channel", on_news)

# Publish (from another client)
db.publish("news_channel", "Maintenance in 5 minutes!")

Time-To-Live (TTL)

Set a document to auto-delete after a specific time (in seconds).

cache_id = db.insert({"session_key": "abc-123"})
db.expire(cache_id, 3600) # Expires in 1 hour

📋 Requirements

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

fluxdb_driver-1.0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

fluxdb_driver-1.0.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file fluxdb_driver-1.0.2.tar.gz.

File metadata

  • Download URL: fluxdb_driver-1.0.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for fluxdb_driver-1.0.2.tar.gz
Algorithm Hash digest
SHA256 fbdda4f25dc2d8f23377aa8a5661cdc4d36a5465c1a85742754a8de15badf675
MD5 6a5aae7294d679ec2b79b09857c44894
BLAKE2b-256 8e9352ce0780a8936ce52e2a3998b421db2dd40f15f11c3969bd48fc2ef36481

See more details on using hashes here.

File details

Details for the file fluxdb_driver-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: fluxdb_driver-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for fluxdb_driver-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 32219b50ab97eafb39a4c73dfabd376e6f347d168f81c0d3a2dd7d9a38f1d56c
MD5 f1a65aa944282cc1d9cf244512b648d4
BLAKE2b-256 f3e6f9aac03f5fded1dedc6041759c743a14c6dcaf6e0a003d94a1ac96518766

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