Skip to main content

Ultra-fast Python ORM with enhanced error handling, monitoring, and type-safe configuration

Project description

Turbo ORM

PyPI version Python 3.8+ License: MIT Tests

The fastest Python ORM. 3-8x faster than SQLAlchemy, with enhanced error handling, monitoring, and type-safe configuration.

from turbo import Database, Model, TextField

class User(Model):
    name = TextField()
    email = TextField()

db = Database("app.db")
db.connect()
User.create_table(db)

user = User(name="Alice", email="alice@example.com")
user.save(db)

⚡ Performance

  • 84,164 ops/sec INSERT (3.5x faster than SQLAlchemy)
  • 993,911 ops/sec SELECT (192x faster than SQLAlchemy)
  • 614,488 ops/sec bulk operations with turbo mode

See full benchmark comparison →

🚀 Features

Core

  • Zero Dependencies - Pure Python, uses built-in sqlite3
  • Async Support - Full async/await with aiosqlite
  • Migrations - Auto-diffing schema management
  • CLI Tools - Project scaffolding and model generation
  • Type Safe - Full IDE autocomplete support

Advanced

  • Vector Search - Semantic similarity search
  • CDC - Change Data Capture for real-time streaming
  • Business Rules - Declarative validation engine
  • RBAC - Role-based access control
  • Redis Cache - Distributed query caching
  • TUI Dashboard - Terminal monitoring interface

NEW in v1.1.0 ✨

  • Enhanced Error Handling - Detailed errors with context and suggestions
  • Query Performance Logging - Automatic slow query detection
  • Type-Safe Configuration - Environment-aware config with validation
  • Health Monitoring - Comprehensive system diagnostics
  • 100% Backward Compatible - All existing code works unchanged

📦 Installation

pip install turbo_orm

# With async support
pip install turbo_orm[async]

# With Redis caching
pip install turbo_orm[redis]

# All extras
pip install turbo_orm[async,redis,http]

🎯 Quick Start

from turbo import Database, Model, TextField, IntegerField

# Define models
class Post(Model):
    title = TextField(required=True)
    content = TextField()
    views = IntegerField(default=0)

# Setup database
db = Database("blog.db")
db.connect()
Post.create_table(db)

# Create
post = Post(title="Hello World", content="My first post")
post.save(db)

# Read
post = Post.get(db, 1)
all_posts = Post.all(db)
popular = Post.filter(db, views__gt=100)

# Update
post.views += 1
post.save(db)

# Delete
post.delete(db)

✨ New in v1.1.0 - Enhanced Developer Experience

1. Enhanced Error Handling

from turbo import Database, Model, TextField

class User(Model):
    name = TextField()

db = Database(":memory:")
User.create_table(db)

try:
    user = User()  # Missing required field
    user.save(db)
except Exception as e:
    # Shows detailed error with context and suggestions
    print(e)

2. Query Performance Monitoring

db = Database("app.db", slow_query_threshold=0.5)
# ... your queries ...
stats = db.get_stats()
print(f"Slow queries: {stats['slow_queries']}")

3. Type-Safe Configuration

from turbo.config import ORMConfig

config = ORMConfig.from_env()  # Load from TURBO_ORM_* env vars
db = Database(config.database_path, pool_size=config.pool_size)

4. Health Monitoring

from turbo.health import DatabaseHealth

health = DatabaseHealth(db)
report = health.full_report()
if report['status'] == 'degraded':
    send_alert(report)

🏆 Why Turbo?

Feature Turbo SQLAlchemy Peewee
INSERT Speed 84k ops/sec 24k ops/sec 10k ops/sec
SELECT Speed 994k ops/sec 5k ops/sec 6k ops/sec
Dependencies 0 2+ 0
Async Support
Vector Search
CDC

📚 Documentation

🎨 Real-World Examples

Check out complete demo applications:

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md.

📄 License

MIT License - see LICENSE file for details.

⭐ Show Your Support

If you find Turbo useful, please consider giving it a star on GitHub!

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

turbo_orm-1.1.0.tar.gz (207.7 kB view details)

Uploaded Source

Built Distribution

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

turbo_orm-1.1.0-py3-none-any.whl (212.3 kB view details)

Uploaded Python 3

File details

Details for the file turbo_orm-1.1.0.tar.gz.

File metadata

  • Download URL: turbo_orm-1.1.0.tar.gz
  • Upload date:
  • Size: 207.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for turbo_orm-1.1.0.tar.gz
Algorithm Hash digest
SHA256 181559a9f424b0873f99909e840b8b16c8bc0a5aa27abd20960071c822d249cc
MD5 560cc3cfdc6fdc8d7afba9aea6c6a970
BLAKE2b-256 272f441b04accbb14cc75a39de3c8d1d9b2bf32a0dc470bd5f453fdf49010527

See more details on using hashes here.

File details

Details for the file turbo_orm-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: turbo_orm-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 212.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for turbo_orm-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f8cbd19b41b4110aa7ad1a27b7724ee2c27c346e9795e074b3696cab74131ae
MD5 6bbc8d24e0161ab964f276af083ad6a0
BLAKE2b-256 9ada05c6ca7ee65def45cf8f5f339130d316970f6b959d478454bd57770e5269

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