mayim


Namemayim JSON
Version 1.1.0 PyPI version JSON
download
home_page
SummaryThe NOT ORM hydrator
upload_time2023-04-11 12:29:09
maintainer
docs_urlNone
author
requires_python
licenseMIT
keywords orm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mayim

> The *NOT* ORM Python hydrator

**What is Mayim?**

The simplest way to describe it would be to call it a **one-way ORM**. That is to say that it does *not* craft SQL statements for you. Think of it as **BYOQ** (Bring Your Own Query).

**Why?**

I have nothing against ORMs, truthfully. They serve a great purpose and can be the right tool for the job in many situations. I just prefer not to use them where possible. Instead, I would rather have control of my SQL statements.

The typical tradeoff though is that there is more work needed to hydrate from SQL queries to objects. Mayim aims to solve that.

## Getting Started

```
pip install mayim[postgres]
```

```python
import asyncio
from typing import List
from mayim import Mayim, PostgresExecutor, sql
from dataclasses import dataclass

@dataclass
class Person:
    name: str

class PersonExecutor(PostgresExecutor):
    @sql("SELECT * FROM people LIMIT $limit OFFSET $offset")
    async def select_all_people(
        self, limit: int = 4, offset: int = 0
    ) -> List[Person]:
        ...

async def run():
    executor = PersonExecutor()
    Mayim(dsn="postgres://...")
    print(await executor.select_all_people())


asyncio.run(run())
```

## Documentation

The docs: [ahopkins.github.io/mayim](https://ahopkins.github.io/mayim/guide/)

## Framework support

Out of the box, Mayim comes with extensions to support Quart, Sanic, and Starlette applications. Checkout the docs for more info.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mayim",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "orm",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/2f/cf/142038eb1ff39d76bf35692e7057b1f47864edd3e042992b01464053de02/mayim-1.1.0.tar.gz",
    "platform": null,
    "description": "# Mayim\n\n> The *NOT* ORM Python hydrator\n\n**What is Mayim?**\n\nThe simplest way to describe it would be to call it a **one-way ORM**. That is to say that it does *not* craft SQL statements for you. Think of it as **BYOQ** (Bring Your Own Query).\n\n**Why?**\n\nI have nothing against ORMs, truthfully. They serve a great purpose and can be the right tool for the job in many situations. I just prefer not to use them where possible. Instead, I would rather have control of my SQL statements.\n\nThe typical tradeoff though is that there is more work needed to hydrate from SQL queries to objects. Mayim aims to solve that.\n\n## Getting Started\n\n```\npip install mayim[postgres]\n```\n\n```python\nimport asyncio\nfrom typing import List\nfrom mayim import Mayim, PostgresExecutor, sql\nfrom dataclasses import dataclass\n\n@dataclass\nclass Person:\n    name: str\n\nclass PersonExecutor(PostgresExecutor):\n    @sql(\"SELECT * FROM people LIMIT $limit OFFSET $offset\")\n    async def select_all_people(\n        self, limit: int = 4, offset: int = 0\n    ) -> List[Person]:\n        ...\n\nasync def run():\n    executor = PersonExecutor()\n    Mayim(dsn=\"postgres://...\")\n    print(await executor.select_all_people())\n\n\nasyncio.run(run())\n```\n\n## Documentation\n\nThe docs: [ahopkins.github.io/mayim](https://ahopkins.github.io/mayim/guide/)\n\n## Framework support\n\nOut of the box, Mayim comes with extensions to support Quart, Sanic, and Starlette applications. Checkout the docs for more info.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The NOT ORM hydrator",
    "version": "1.1.0",
    "split_keywords": [
        "orm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "462271ef50447d7b8e9ae12de4f4f2187ec49883faed7b38e3f457dcd71a544e",
                "md5": "1fe9739eb75db75622e94a7e5d17831d",
                "sha256": "918bfca7d7b34d7957127576fa0701b1517b5eeefb1f0183f3561b510d1bcc62"
            },
            "downloads": -1,
            "filename": "mayim-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1fe9739eb75db75622e94a7e5d17831d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 30253,
            "upload_time": "2023-04-11T12:29:08",
            "upload_time_iso_8601": "2023-04-11T12:29:08.012027Z",
            "url": "https://files.pythonhosted.org/packages/46/22/71ef50447d7b8e9ae12de4f4f2187ec49883faed7b38e3f457dcd71a544e/mayim-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2fcf142038eb1ff39d76bf35692e7057b1f47864edd3e042992b01464053de02",
                "md5": "88efd5b86fef326d0dff9899f841ae1f",
                "sha256": "43c002dda52b584c6931841f56690181e75e97b0316fdf533d82f1d964e7ce29"
            },
            "downloads": -1,
            "filename": "mayim-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "88efd5b86fef326d0dff9899f841ae1f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 20651,
            "upload_time": "2023-04-11T12:29:09",
            "upload_time_iso_8601": "2023-04-11T12:29:09.659260Z",
            "url": "https://files.pythonhosted.org/packages/2f/cf/142038eb1ff39d76bf35692e7057b1f47864edd3e042992b01464053de02/mayim-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-11 12:29:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "mayim"
}
        
Elapsed time: 0.05735s