Skip to main content

SmartKDB v5 – The Cognitive AI-Native Database Platform

Project description

SmartKDB v5 🧠

The Easiest Database for Python

PyPI version Python

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 examples/quickstart.py

This will show you:

  • ✅ Creating tables
  • ✅ CRUD operations (Create, Read, Update, Delete)
  • ✅ Querying with filters
  • ✅ Real-world examples

🚀 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

💡 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 examples/ folder!


🎮 Try It Now

# Clone and run examples
git clone https://github.com/alhdrawi/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

Made with ❤️ by Alhdrawi

Star ⭐ this repo if you find it useful!

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

smartkdb-5.0.3.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

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

smartkdb-5.0.3-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file smartkdb-5.0.3.tar.gz.

File metadata

  • Download URL: smartkdb-5.0.3.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for smartkdb-5.0.3.tar.gz
Algorithm Hash digest
SHA256 f4169c8f1e6d71a90927f8fcb4a49d3c3a15bc10e2c7756aadefb0da5b99450d
MD5 ea645ead6690c1ae46ba0ee125dac6b8
BLAKE2b-256 b5057339233335103d5588bef7a5dbbe43bff63617c0da09bf0e0aef3f4dc3ce

See more details on using hashes here.

File details

Details for the file smartkdb-5.0.3-py3-none-any.whl.

File metadata

  • Download URL: smartkdb-5.0.3-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for smartkdb-5.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 debcc4449770a84f625aff6f869a537de0e886f559576776b1e728ede15b9bab
MD5 f7a2335e6bda69d8029f216759fc6d6e
BLAKE2b-256 e38916163515b6b617bed24d872583c1d3dd750016c0c15ec2fbf9035a6cde1a

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