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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cflaremodel-0.1.7.tar.gz
  • Upload date:
  • Size: 22.0 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.7.tar.gz
Algorithm Hash digest
SHA256 4e2901a85fc2b947b93e7fcb15e77e23a6410e08c33cad4fde766f9dad35b228
MD5 8622f1c70524e5971ce3869a12090eb2
BLAKE2b-256 213b2772c48ee06049079bfb42ea2f41d6abcacef20ce5212e63d2cb2e498ed8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cflaremodel-0.1.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 244755806bd73729dd38424a145bbe7e5e1152e67df1993f2a4604e420b2a59c
MD5 51c939599eefbaea03dce21d1d8fcead
BLAKE2b-256 8c27441393d9cf4c94eb646f5d6bbeaa76091dab23c19b63c0f5b2c792f0467e

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