Skip to main content

No project description provided

Project description

flaremodel/README.md

🔥 FlareModel

FlareModel is a lightweight, async-first ORM for Python inspired by Laravel's Eloquent. Built for Cloudflare D1 and other serverless databases, it offers a fluent API, relationship management, and automatic schema introspection — all in a minimal package.


✨ Features

  • ✅ Fluent, chainable query builder (where(), with_(), limit() etc.)
  • ⚡ Async by default — built for modern Python 3.8+
  • 🔁 Eager and lazy loading of relationships
  • 📄 Schema introspection (fillable, casts, etc.)
  • ☁️ D1-first, but pluggable with other SQL drivers

📦 Installation

pip install flaremodel

🚀 Quickstart

from flaremodel import Model
from flaremodel import D1Driver

# Example User model
class User(Model):
    table = "users"
    fillable = ["name", "email"]
    casts = {"created_at": "datetime"}

async def on_fetch(request, env):
    # Setup driver
    Model.set_driver(driver=D1Driver(env.DB))
    # Query
    users = await User.query().where("email", "like", "%@example.com").get()

🧱 Defining Relationships

class Post(Model):
    table = "posts"

    async def user(self):
        return await self.belongs_to(User, "user_id")

class User(Model):
    table = "users"

    async def posts(self):
        return await self.has_many(Post, "user_id")

🧠 Schema Introspection

User.introspect({
    "name": {"type": "str"},
    "email": {"type": "str"},
    "created_at": {"type": "datetime"},
    "hidden": ["password"]
})

📜 License

GNU GPLv3 © 2025 — avltree9798

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

cflaremodel-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

cflaremodel-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file cflaremodel-0.1.0.tar.gz.

File metadata

  • Download URL: cflaremodel-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.5 Darwin/24.3.0

File hashes

Hashes for cflaremodel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9bb7418b201f7b7cce8b0e14561c4dbdf6c1a52486eaa0b9f19ec0191140e7ad
MD5 ba6f2d7ebcdd7270148e6e4cf9e88191
BLAKE2b-256 b2b1d77388329498cfbb7491e40b48884e937fc21b2701f6a07b7bad137c47fd

See more details on using hashes here.

File details

Details for the file cflaremodel-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cflaremodel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.5 Darwin/24.3.0

File hashes

Hashes for cflaremodel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbf4bad6f417440e8a0d60dd09b7cefc6a8d21e6c8d0c95f803aa0b6f4c9f634
MD5 8e69c712d05f35c8f8892777bf81cd6e
BLAKE2b-256 8b0701635cfb1082433baccdf26b314e17cf60ab26b254a5a4d864537ada1b66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page