sqlmodel-query-builder


Namesqlmodel-query-builder JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryA seriazable object for SQLModel queries
upload_time2024-11-18 12:16:04
maintainerNone
docs_urlNone
authorPedro Sader Azevedo
requires_python<4.0,>=3.12
licenseGPL-3.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SQLModel Query Builder

A serializable object for simple SQLModel queries.

## Why this exists

SQLModel is an Object Relation Mapper (ORM) library that provides great abstractions for interacting with relational databases, such as PostgreSQL and SQLite, via Python. SQLModel gives its users the option to write queries using its own "pythonic" functions, which is safer and easier (in my opinion) than writing raw SQL. Here's what an SQLModel looks like:

```python
with Session(engine) as session:
    statement = select(Hero, Team).join(Team).where(Team.name == "Preventers")
    results = session.exec(statement)
```

In this example, [from SQLModel's own documentation](https://sqlmodel.tiangolo.com/tutorial/connect/read-connected-data/#include-the-team), the words `Hero` and `Team` are classes that represent tables in the database. 

As convenient as it is, this approach to writing queries has a major drawback: there is no built-in to serialize SQLModel queries. The implication is that you cannot easily dump them into a JSON object that can be sent and received in a REST API, which is a major usecase when developing database applications.

Thus, `sqlmodel-query-builder` exists to close (or at least narrow) this gap by providing a serializable object for SQLModel queries. For now, it only supports simple queries that involve only `SELECT`, `JOIN`, and `WHERE` statements.

## License

This work is licensed under the terms of the GPLv3.

## Copyright

© 2024 Brazilian Center for Research in Energy and Materials (CNPEM)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sqlmodel-query-builder",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": "Pedro Sader Azevedo",
    "author_email": "pedro.saderazevedo@lnbr.cnpem.br",
    "download_url": "https://files.pythonhosted.org/packages/90/b5/f78bcc562fa6be178e5c9c39924d6b667c6316062a037b873fd77a6aea4b/sqlmodel_query_builder-0.0.2.tar.gz",
    "platform": null,
    "description": "# SQLModel Query Builder\n\nA serializable object for simple SQLModel queries.\n\n## Why this exists\n\nSQLModel is an Object Relation Mapper (ORM) library that provides great abstractions for interacting with relational databases, such as PostgreSQL and SQLite, via Python. SQLModel gives its users the option to write queries using its own \"pythonic\" functions, which is safer and easier (in my opinion) than writing raw SQL. Here's what an SQLModel looks like:\n\n```python\nwith Session(engine) as session:\n    statement = select(Hero, Team).join(Team).where(Team.name == \"Preventers\")\n    results = session.exec(statement)\n```\n\nIn this example, [from SQLModel's own documentation](https://sqlmodel.tiangolo.com/tutorial/connect/read-connected-data/#include-the-team), the words `Hero` and `Team` are classes that represent tables in the database. \n\nAs convenient as it is, this approach to writing queries has a major drawback: there is no built-in to serialize SQLModel queries. The implication is that you cannot easily dump them into a JSON object that can be sent and received in a REST API, which is a major usecase when developing database applications.\n\nThus, `sqlmodel-query-builder` exists to close (or at least narrow) this gap by providing a serializable object for SQLModel queries. For now, it only supports simple queries that involve only `SELECT`, `JOIN`, and `WHERE` statements.\n\n## License\n\nThis work is licensed under the terms of the GPLv3.\n\n## Copyright\n\n\u00a9 2024 Brazilian Center for Research in Energy and Materials (CNPEM)\n",
    "bugtrack_url": null,
    "license": "GPL-3.0",
    "summary": "A seriazable object for SQLModel queries",
    "version": "0.0.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8213dc9fc4ab2a40d3a57672f20cbefc002fe42ecbf9b765acca5c5641297362",
                "md5": "3b3e51b8b6f6f0699b2d8f67373dd3b6",
                "sha256": "1b92037bbfb1f40d60921f967c06bc94e373f3822bacd8ed26520af4a9981e3c"
            },
            "downloads": -1,
            "filename": "sqlmodel_query_builder-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b3e51b8b6f6f0699b2d8f67373dd3b6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 3338,
            "upload_time": "2024-11-18T12:16:02",
            "upload_time_iso_8601": "2024-11-18T12:16:02.451820Z",
            "url": "https://files.pythonhosted.org/packages/82/13/dc9fc4ab2a40d3a57672f20cbefc002fe42ecbf9b765acca5c5641297362/sqlmodel_query_builder-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "90b5f78bcc562fa6be178e5c9c39924d6b667c6316062a037b873fd77a6aea4b",
                "md5": "59e85ab86c2f77bae931e51f7c13526a",
                "sha256": "d130335c3dd1eb41e60f9d973d17ce2d3c844073305044a56ae2ac6d75b3ee1a"
            },
            "downloads": -1,
            "filename": "sqlmodel_query_builder-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "59e85ab86c2f77bae931e51f7c13526a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 2765,
            "upload_time": "2024-11-18T12:16:04",
            "upload_time_iso_8601": "2024-11-18T12:16:04.080243Z",
            "url": "https://files.pythonhosted.org/packages/90/b5/f78bcc562fa6be178e5c9c39924d6b667c6316062a037b873fd77a6aea4b/sqlmodel_query_builder-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 12:16:04",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sqlmodel-query-builder"
}
        
Elapsed time: 0.41954s