Skip to main content

SmartKDB v5 🧠

The Easiest Database for Python

PyPI version Python Documentation

SmartKDB is a local-first database that's as easy as a Python dictionary, but with superpowers:

  • 🚀 No setup - Works instantly
  • 💾 ACID Transactions - Bank-grade safety
  • 🧠 AI-Powered - Learns from your usage
  • Time-Travel - Query past data
  • 📦 Pure Python - No dependencies

🎯 Install in 10 Seconds

pip install smartkdb

⚡ Use in 30 Seconds

from smartkdb import SmartKDB

# Create database
db = SmartKDB("mydb.kdb")

# Create table
users = db.create_table("users")

# Add data
users.insert({"name": "Alice", "age": 25})
users.insert({"name": "Bob", "age": 30})

# Query data
results = users.query().where("age", ">", 25).execute()
print(results)  # [{'name': 'Bob', 'age': 30}]

That's it! 🎉


📚 Learn in 5 Minutes

Run our interactive tutorial:

python -c "from smartkdb import SmartKDB; help(SmartKDB)"

Or check our example files:


🚀 What Makes SmartKDB Special?

1. Zero Configuration

No servers, no config files, no complexity. Just pip install and code.

2. ACID Transactions

tx = db.tx_manager.begin()
try:
    users.insert({"name": "Charlie"}, transaction_id=tx)
    db.tx_manager.commit(tx)
except:
    db.tx_manager.rollback(tx)

3. AI Brain 🧠

The database learns from your queries and suggests optimizations:

db.brain.suggest_indexes("users")
# Returns: ['Create index on email for faster queries']

4. Time-Travel Queries

See your data as it was in the past:

history = db.version_manager.get_history("users", "user_123")
# Shows all versions of the record

📖 Complete Documentation

Guide Description
📘 User Guide For beginners - Step-by-step tutorials
🛠️ Developer Guide For advanced users - API deep dive
🏗️ Architecture How SmartKDB works internally
🔌 API Reference Complete method documentation
📦 Installation Detailed installation guide

Full Documentation: https://smartkdb.readthedocs.io/


💡 More Examples

Example 1: E-Commerce Store

db = SmartKDB("store.kdb")
products = db.create_table("products", indexes=["category"])

products.insert({
    "name": "Laptop",
    "price": 999,
    "category": "Electronics"
})

# Find all electronics under $1000
cheap_electronics = products.query()\
    .where("category", "==", "Electronics")\
    .where("price", "<", 1000)\
    .execute()

Example 2: User Management

users = db.create_table("users", pk="email", indexes=["role"])

users.insert({"email": "admin@company.com", "role": "admin"})

# Update user
users.update("admin@company.com", {"role": "superadmin"})

# Delete user
users.delete("old_user@company.com")

See more in our examples folder!


🎮 Try It Now

# Clone and run examples
git clone https://github.com/alhdrawiz6-ai/smartkdb
cd smartkdb
python examples/quickstart.py
python examples/transactions.py
python examples/ai_features.py

🤝 Contributing

We welcome contributions! See CONTRIBUTING.md


📄 License

MIT License - See LICENSE


🌟 Why SmartKDB?

Feature SmartKDB SQLite MongoDB
Easy to use ✅ Python dict-like ⚠️ SQL required ⚠️ Schema complex
No setup ❌ Server needed
ACID ⚠️ Partial
AI Features ✅ Brain & Optimization
Time-Travel ✅ Built-in
Pure Python ❌ C extension ❌ Server

Perfect for:

  • 🎯 Prototypes & MVPs
  • 📱 Desktop applications
  • 🤖 AI/ML projects
  • 📊 Data analysis scripts
  • 🧪 Testing & experiments

🔗 Links


Made with ❤️ by Alhdrawi

Star ⭐ this repo if you find it useful!

Release files for smartkdb 5.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartkdb 5.0.5
File Size Uploaded
smartkdb-5.0.5.tar.gz 32.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smartkdb 5.0.5
File Interpreter ABI Platform
smartkdb-5.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 52.9 kB

Release files / smartkdb-5.0.5.tar.gz

Download URL smartkdb-5.0.5.tar.gz
Size 32.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fc52ca39ad8a4d822f1815bac3afc9b092df82705e391efcb231e4626cf7e56a
BLAKE2b-256 checksum
How to use checksums
b412e17d5092c23836f527f13fb7ab714b6e12fcc8316f972d37197c4ec1525d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / smartkdb-5.0.5-py3-none-any.whl

Download URL smartkdb-5.0.5-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f902366c19d8526ef6c14adff37e449ae49cdb718c52e2287aa85e4d72bc3104
BLAKE2b-256 checksum
How to use checksums
391e42f6a2064e8af56710b9d97f424237f224463baac38e35e2e102e97610ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

5.0.5 This release

2 release files

5.0.4

2 release files

5.0.3

2 release files

5.0.2

2 release files

5.0.1

2 release files

5.0.0

2 release files

4.1.0

2 release files

4.0.3

2 release files

4.0.2

2 release files

4.0.0

2 release files

1.0.0

2 release files

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