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.0.tar.gz (31.7 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.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartkdb-5.0.0.tar.gz
  • Upload date:
  • Size: 31.7 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.0.tar.gz
Algorithm Hash digest
SHA256 909b6e11dfb722c5d768b9bfb3e01683c611739ef68c203f8bdb0198ed14722f
MD5 1594a958d573681b0868717681faf685
BLAKE2b-256 5550c309fc1062ae344c9c95889b0054e55454c1f0821ae5ad706fc8645a4e40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartkdb-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6dcb61dccb106d5dc745ff0ff0eed91656b694df7fb4a092332366a20b36be50
MD5 141ea8a291114c7053958a7bf6cfed97
BLAKE2b-256 fd5216fe8ed12bd6fb431c903daaa2399e9c58be1a3953d241d20d41fd126e98

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