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

Uploaded Source

Built Distribution

cflaremodel-0.1.14-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cflaremodel-0.1.14.tar.gz
Algorithm Hash digest
SHA256 5c2d937757f23dfb352ac3ff21b4c26cacac27885f789ae62825ef746a57e78c
MD5 2100ebbd9b8193da0ee1f67a371168cc
BLAKE2b-256 f7db793e4bf09f9243a7a53eeb14d33678411576e28453e3de6786860a4d9c0c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cflaremodel-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 ba7dcc92992fe0e971503ee33c57ab505f47f51922cfd0f9c2525b38ade96a11
MD5 ef7859ca3a0c58865a817ee1fb2eb8e5
BLAKE2b-256 df7e4f72f093377dbf2f19b48ffc21f50bde1ec1a178d2a8e8c593b1a1436e6f

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