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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cflaremodel-0.1.15.tar.gz
  • Upload date:
  • Size: 20.5 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.15.tar.gz
Algorithm Hash digest
SHA256 c74e8e992f58d5c1b7732ce669c52b3675f02016fe47ed4731db6b81b3728cac
MD5 9792f4ed50c7cc373b8dbf07819f3c96
BLAKE2b-256 c2f08ea524ea3212031cfb2b773fe2621e08368780ae7020f95002efaaaa0d95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cflaremodel-0.1.15-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.12 Darwin/24.2.0

File hashes

Hashes for cflaremodel-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 5b8baed5e20cc9949b217c4d3317bf2ba8c4835ca3ce3a4a8ce0806820456301
MD5 db34342dff577d6ba05b655a376ca029
BLAKE2b-256 2af1cfb7b9df18bc8547d04b9ba73441922533b5b870aef2a553abfdcfa43410

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