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

Uploaded Source

Built Distribution

cflaremodel-0.1.4-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cflaremodel-0.1.4.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.5 Darwin/24.3.0

File hashes

Hashes for cflaremodel-0.1.4.tar.gz
Algorithm Hash digest
SHA256 6ac1e1ac6e81f9aa463da4f43de5879b828c2ad697b327081b607c5b34f93d49
MD5 b460645fbcf2f83378ef80a7955b7282
BLAKE2b-256 b7c23038cef3495fbbac61b49a5702fbfd85f8a72cec6b62ba3824254b7b0eab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cflaremodel-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.5 Darwin/24.3.0

File hashes

Hashes for cflaremodel-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e74ccf3d14659d8a8433d01a5b888ce369c55e0c7d03306e3e7709162f22d537
MD5 5bacfe2b6bc818e9f0640cddcf79d4f4
BLAKE2b-256 9e6a1752fc99f84375c3a7a5072982f048c7bfe77a1fd1d7ae0d6b622097824a

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