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.4.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.4-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartkdb-5.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 5324de552f438a5188ce5604b9d5af463352d4a9f0eaaff0ecef98002357bb78
MD5 4985505fa71216763c79f0c510171b9e
BLAKE2b-256 2b569266d266c71685731283a7a032e74a084363496f462a4df63ab826d39acf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartkdb-5.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 58a474515e95db2b49edcaa6b7f6d02a6c07ef849fcbea6277a36ef06c21b6fd
MD5 e27e23df59cee9975c52966f6ade3a38
BLAKE2b-256 14b30766cca8d93c9318a4362517ee47fd89f11bac36f10f21569fc480a4acfd

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