Skip to main content

Powerful yet simple Python ORM

Project description

https://raw.githubusercontent.com/zergos/quazydb/master/docs/source/images/logo_mini.png

Powerful yet simple asynchronous Python ORM

Let’s combine all modern ORMs with business essence into something intuitive and simple.

Example:

import random

from quazy import DBFactory, DBTable


class Product(DBTable):
    name: str
    price: float
    description: str = None


if __name__ == "__main__":
    db = DBFactory.postgres("postgresql://quazy:quazy@127.0.0.1/quazy")
    db._debug_mode = True
    db.use_module()

    db.clear()
    db.create()

    for i in range(100):
        db.insert(Product(name=f'Product #{i + 1}', price=random.randint(1, 1000) / 100))

    q = Product.query().filter(lambda x: x.price >= 5)
    print("Total amount:", q.fetch_count())
    print("Average price:", q.fetch_avg("price"))
    print("Products:")
    for x in q:
        print(x.name, "->", x.price)

Or code in async:

import asyncio
import random

from quazy import DBFactoryAsync, DBTable

class Product(DBTable):
    name: str
    price: float
    description: str = None


async def main():
    db = DBFactoryAsync.postgres("postgresql://quazy:quazy@127.0.0.1/quazy")
    db._debug_mode = True
    db.bind_module()

    await db.clear()
    await db.create()

    for i in range(100):
        await db.insert(Product(name=f'Product #{i + 1}', price=random.randint(1, 1000) / 100))

    q = Product.query().filter(lambda x: x.price >= 5)
    print("Total amount:", await q.fetch_count())
    print("Average price:", await q.fetch_avg("price"))
    print("Products:")
    async for x in q:
        print(x.name, "->", x.price)

if __name__ == "__main__":
    asyncio.run(main())

Documentation

https://quazydb.readthedocs.io/en/latest/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quazydb-1.3.3-py3-none-any.whl (54.3 kB view details)

Uploaded Python 3

File details

Details for the file quazydb-1.3.3-py3-none-any.whl.

File metadata

  • Download URL: quazydb-1.3.3-py3-none-any.whl
  • Upload date:
  • Size: 54.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for quazydb-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 459915caed5a55af2128d6c059a124a5f9c834a2a2be35a1302a93b6a3785f9f
MD5 70926c33fbe7c7c615ebe3ba88e8e044
BLAKE2b-256 db2816218d02ebe3d2ef9478374d99c27904787c8e7c5d1a1cf0a187d54b7aa6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page