Skip to main content

No project description provided

Project description

🔥 CFlareModel

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

⚠️ When using CFlareModel on Cloudflare Workers, you must vendor your Python dependencies. Follow this official guide: https://github.com/cloudflare/python-workers-examples/blob/main/06-vendoring/README.md


✨ Features

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

📦 Installation

pip install cflaremodel

🚀 Quickstart

from cflaremodel import Model
from cflaremodel 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")

📜 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.13.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

cflaremodel-0.1.13-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cflaremodel-0.1.13.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.9 Darwin/24.2.0

File hashes

Hashes for cflaremodel-0.1.13.tar.gz
Algorithm Hash digest
SHA256 16986fda4902328bccf518e55cdd6bd6c7366a0fe2b37c3dbfa167d3d788ed2f
MD5 3a788f2dd3d3ad81612276d007131f80
BLAKE2b-256 f96da757fe959fdddfcdc2a7e68537cfc10709bf1b0af9f4b25ed8cf13fbac5a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cflaremodel-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.9 Darwin/24.2.0

File hashes

Hashes for cflaremodel-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 09eed5a9f8dd7dcade53b60ecbb1890cca9120c7a40189de52a8e5c27188b9bd
MD5 8f8bf82c9f9051388d678ccf0f111adc
BLAKE2b-256 4e19789b39885e0039a6856499930de1a3919f258381f94406ea524e23c93fcc

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