Skip to main content

Official Python driver for the FluxDB C++ Database

Project description

FluxDB Python Driver

PyPI Version License Python

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

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.post1.tar.gz (6.3 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.post1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fluxdb_driver-1.0.2.post1.tar.gz
  • Upload date:
  • Size: 6.3 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.post1.tar.gz
Algorithm Hash digest
SHA256 a3dc2b45f08b9ed19aef634c6a74b696c8fa709e2519ecbc855d2ba737ff6745
MD5 ab5c52bb4aeebd8aeb613cccea55eb3d
BLAKE2b-256 0a09e529d87842cd29e9a30a1c30771d30433787ff90acab9b14dc132fea7f33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fluxdb_driver-1.0.2.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 95532dda70db443c4829183e0f0c8638cd3ab4419018beb72c36ca1402af26ce
MD5 29677126010a0b82be69453a61871ca8
BLAKE2b-256 5c20b26b69e3f398a421080daa622183da2e060e65f2a6d2505366e7a03b6b3a

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