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.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

cflaremodel-0.1.1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cflaremodel-0.1.1.tar.gz
  • Upload date:
  • Size: 20.1 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.1.tar.gz
Algorithm Hash digest
SHA256 8ccd07526ab04331b899addb8eee9d3b7f57aa701189fd25b6de1d330761f751
MD5 c2de034037be4d739301e22f774d91fd
BLAKE2b-256 9c3f44dba9fca835fa7ce6707f2f7e398d00bdc4570957b764a0bd5858b5f0a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cflaremodel-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f62e749cfb6bdc0ac34181adb5af9b3432d448c51beab649e4e3a01b88c4bb43
MD5 100ddc5496b1c7ef46a90d9bad5e40c0
BLAKE2b-256 d8b7e7d13e346c4ecad1c973d309388360bbe00bbe83ab19bcf6176869e0bc3b

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