SmartKDB – Cognitive & AI-Training-Aware Embedded Database
Project description
SmartKDB 🧠
The Cognitive, AI-Native Embedded Database for Python.
SmartKDB is a next-generation embedded database engine written in pure Python. It goes beyond storing data—it understands it. With built-in vector search, a cognitive agent you can chat with, and an AI training hub, SmartKDB is designed for modern AI engineering.
🚀 Key Features
1. Core Engine
- Local-First & Embedded: No servers to manage. Just a file in your project.
- Hybrid Storage: Supports structured tables and unstructured JSON documents.
- Secure: Built-in Role-Based Access Control (RBAC).
2. Cognitive Intelligence (v4)
- 💬 Chat with Data: Ask
db.chat("How is the system health?")to get answers. - 🔮 Predictive Engine: Forecasts which tables will be "hot" based on usage patterns.
- 🧠 Knowledge Graph: Automatically tracks relationships between your data entities.
3. AI Training Hub (v4)
- 🎓 Dataset Management: Create, version, and split datasets (Train/Test/Val) natively.
- 📉 Experiment Tracking: Log model training metrics (loss, accuracy) directly into the DB.
4. Self-Learning (v3)
- ⚡ Auto-Tuning: The "Brain" learns from your queries and automatically creates indexes.
- 🔍 Vector Search: Store embeddings and perform similarity search locally.
- 🗣️ Semantic Query: Query using natural language:
db.semantic_query("users", "engineers over 30").
📦 Installation
pip install smartkdb
📖 Official Guide
1. Getting Started
Initialize the database and create your first table.
from kdb import SmartKDB
# Initialize DB (creates a folder 'mydb.kdb')
db = SmartKDB("mydb.kdb")
# Create a user (First time setup)
db.auth.create_user("admin", "secret_pass", "admin")
db.login("admin", "secret_pass")
# Create a table
users = db.create_table("users")
# Insert data
users.insert({"name": "Alice", "age": 30, "role": "Engineer"})
users.insert({"name": "Bob", "age": 24, "role": "Designer"})
# Simple Query
results = users.query().where("age", ">", 25).execute()
print(results)
2. Cognitive Features (Chat & Agent)
SmartKDB v4 includes an embedded agent. You don't need to write complex queries for metadata; just ask.
# Chat with your DB
response = db.chat("Which tables are most active?")
print(response['message'])
# Ask for recommendations
response = db.chat("Do you suggest any indexes?")
print(response['actions'])
3. AI & Vector Search
Store vector embeddings (lists of floats) and search by similarity.
# Enable vector index on a field
db.enable_vector_index("products", "description")
# Perform Semantic Search (Natural Language)
# This uses the internal vector engine to find similar items
results = db.vector_search("products", "comfortable running shoes", "description")
4. AI Training Hub
Use SmartKDB to manage your Machine Learning lifecycle.
Managing Datasets
# Create a dataset from the 'users' table, filtering for Engineers
db.datasets.create_dataset(
name="engineer_ages",
table="users",
filter_query={"role": "Engineer"}
)
# Define splits (80% Train, 10% Val, 10% Test)
db.datasets.define_split("engineer_ages", 0.8, 0.1, 0.1)
Logging Experiments
# Start a training session
session_id = db.training_logger.start_session(
model_name="age_predictor",
dataset_name="engineer_ages",
config={"learning_rate": 0.01}
)
# Log metrics during training
db.training_logger.log_metric(session_id, step=1, metrics={"loss": 0.5})
db.training_logger.log_metric(session_id, step=2, metrics={"loss": 0.3})
# End session
db.training_logger.end_session(session_id, status="success")
5. Dashboard & Management
SmartKDB comes with a built-in HTML dashboard.
- Navigate to your database folder (
mydb.kdb). - Open
kdb_config.htmlin any web browser. - Features:
- Brain Center: View learned patterns and feedback.
- Cognitive Engine: Chat interface with the Agent.
- Training Hub: View datasets and experiment logs.
- Config: Manage users and auto-indexing settings.
🔧 CLI Reference
SmartKDB includes a command-line tool.
# Initialize a new DB in the current directory
smartkdb init
# Check status of an existing DB
smartkdb status
# Open an interactive SQL-like shell (Coming Soon)
smartkdb shell
🛡️ Architecture
SmartKDB is Local-First. All data is stored in the directory you specify.
data/: Raw data blocks (append-only).indexes/: B-Tree and Hash indexes.kdb_brain.json: The learned model of your data usage.kdb_knowledge.json: The semantic knowledge graph.kdb_training.json: Logs of your ML experiments.
License: MIT
Author: Alhdrawi
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 smartkdb-4.0.0.tar.gz.
File metadata
- Download URL: smartkdb-4.0.0.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65f3187af99cad980a19ce458ac61648acf2b882ed99b90e9daa9f5a77501865
|
|
| MD5 |
f86f6f7e7107a8a1650cd40b81583c15
|
|
| BLAKE2b-256 |
b07725c2a5249ad7c3d92be25fc4a5116e1a8955430643337d4c1f6b3e095144
|
File details
Details for the file smartkdb-4.0.0-py3-none-any.whl.
File metadata
- Download URL: smartkdb-4.0.0-py3-none-any.whl
- Upload date:
- Size: 28.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed2d46178ec9a7cbfc6d151361ed1b706465d00fa6e414d08acaf99f3d31fbd7
|
|
| MD5 |
49991dbb2ebbecb5e17d13906596e902
|
|
| BLAKE2b-256 |
4252f68620b63cc6894ec8aeb2a15282aaf66d7b32bd1f2c6ccdd71578713860
|