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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cflaremodel-0.1.11.tar.gz
  • Upload date:
  • Size: 22.7 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.11.tar.gz
Algorithm Hash digest
SHA256 ee67bf0f17cd315480bff2093b94fc41120479b37ed6f4570bae9f7e6bb7a302
MD5 b7d7d3ecfdbe5e1a2e07a826fd4577f7
BLAKE2b-256 15784cb170433120485e953aa0507bd785328bdf9e8a0f3095996e7eabd2f347

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cflaremodel-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 053e3e8266f9ad470b688b0a6e76a89697243d6fcaf2d9eacaf8cfddd8685928
MD5 a94f8e7e690b49161a08fe548d9d544d
BLAKE2b-256 f725773ce85d47f52a4d8e97d972416dd19b2d7f5c751342a889d4622af392a1

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