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.2.tar.gz (33.4 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.2-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartkdb-5.0.2.tar.gz
  • Upload date:
  • Size: 33.4 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.2.tar.gz
Algorithm Hash digest
SHA256 477078639aad3abec8922762172d801586c8f8df857885b111adea37e887b654
MD5 4fba2468e19f5f8dfd7061761dfd1140
BLAKE2b-256 95eb8979ce07fc0a0aac4c3bd6117820b3b7d02e0acac6490b0151ec4ee37568

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartkdb-5.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 524f0d3fa130fecbae477de4d01feb91bc792586491275a5c6de79d83b17fbe1
MD5 eb6a4c85ff8c418db25b3b7312e8388c
BLAKE2b-256 d7e80b6627ad469682857678b86f59954613a306796685e486b46645f1eff9ae

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