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 for Cloudflare D1 and other serverless databases, it offers a fluent API, relationship management, and automatic schema introspection — all in a minimal package.


✨ Features

  • ✅ Fluent, chainable query builder (where(), with_(), limit() etc.)
  • ⚡ Async by default — built for modern Python 3.8+
  • 🔁 Eager and lazy loading of relationships
  • 📄 Schema introspection (fillable, casts, etc.)
  • ☁️ 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")

🧠 Schema Introspection

User.introspect({
    "name": {"type": "str"},
    "email": {"type": "str"},
    "created_at": {"type": "datetime"},
    "hidden": ["password"]
})

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cflaremodel-0.1.2.tar.gz
  • Upload date:
  • Size: 20.0 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.2.tar.gz
Algorithm Hash digest
SHA256 7c33430a2c9f5eeb71d1c19739693ae226af86f4cb9c2f624c913a57923d2ea6
MD5 896ef766c4442b734fb515efb06c3d08
BLAKE2b-256 e7efe3c877c092e96760332bff011b10ba3d84a669240619ef10e51d0198ac41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cflaremodel-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f06d0b2305ca26c7c97c636ced1c82a831b9b1eb261b1e969889053c768ad50
MD5 b3e4a06341a2103660b8c75b1c6a552b
BLAKE2b-256 08de2baebb949e81a02a61f10fc654cd07222b0e5ab2e71a3b626655c3eff25b

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