Metadata-Version: 2.4
Name: quazydb
Version: 1.3.6
Summary: Powerful yet simple Python ORM
Author-email: Andrey Aseev <andrey@aseev.biz>
Maintainer-email: Andrey Aseev <andrey@aseev.biz>
License-Expression: Apache-2.0
Project-URL: Documentation, https://quazydb.readthedocs.io/en/latest/
Project-URL: Repository, https://github.com/zergos/quazydb.git
Project-URL: Issues, https://github.com/zergos/quazydb/issues
Keywords: ORM,database,postgres,model,data
Classifier: Development Status :: 5 - Production/Stable
Classifier: Topic :: Database
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: strenum; python_version <= "3.11"
Provides-Extra: strict
Requires-Dist: pydantic; extra == "strict"
Provides-Extra: psycopg
Requires-Dist: psycopg[binary,pool]; extra == "psycopg"
Dynamic: license-file

quazydb
#######

.. image:: 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:
========

..  code-block:: python

    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:

..  code-block:: python

    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/
