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

Uploaded Source

Built Distribution

cflaremodel-0.1.6-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cflaremodel-0.1.6.tar.gz
  • Upload date:
  • Size: 21.9 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.6.tar.gz
Algorithm Hash digest
SHA256 7b0ef7494c10eb8c1672f2a9246efb0ce6c132dd5d105bbef024b4d78b908039
MD5 a197c7464849330edda4a31235274396
BLAKE2b-256 aa9db3c2a80190f503b803a2cb234e81962ebb9e757821bbd8a06450b437e033

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cflaremodel-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 20.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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ee846648c51e9c081b7291a2d6e7247b62316a2572ce6ccf635ee59ac7d054e6
MD5 d2002ad25d2536f833d5e5f0d56b35fb
BLAKE2b-256 1109949a467a894ac1c344c666a4c91bed01f0111c59acf894f0a96b32b98b14

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