| Name | sqlalchemy-sessionload JSON |
| Version |
1.1.0.post2
JSON |
| download |
| home_page | None |
| Summary | SQLAlchemy load option that loads only from persisted session instances |
| upload_time | 2025-10-16 18:47:06 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.10 |
| license | MIT License Copyright (c) 2024 Jan Vollmer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| keywords |
sqlalchemy
session
loader
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# sqlalchemy-sessionload

[](https://github.com/jvllmr/sqlalchemy-sessionload/blob/dev/LICENSE)
[](https://app.codecov.io/gh/jvllmr/sqlalchemy-sessionload/tree/dev)
[](https://github.com/jvllmr/sqlalchemy-sessionload/actions/workflows/test.yaml)
SQLAlchemy load option that loads from persisted session instances.
The goal of this load option is to achieve performance gains in specific use-cases by not querying the database or serializing new objects and reading from cache instead. This means that you as a user need to make sure before that all of the objects you expect to find within a query are already present the session store. Use with care!
## Basic usage
SessionLoad is available for basic queries and relationship loading
Filters and Order By constructs are also supported.
If you miss something you are invited to contribute.
For installation the plugin has to be registered:
```python
from sqlalchemy_sessionload import SQLAlchemySessionLoad
Session = sessionmaker(...)
SQLAlchemySessionLoad(Session)
```
### Simple Query
```python
from sqlalchemy_sessionload import SessionLoad
from project.model import Message
# assignment is needed
# otherwise instances are not saved in session
all_messages = session.query(Message).all()
session_messages = session.query(Message).options(SessionLoad(Message)).all()
```
### Load relationship
Joined loading is currently only available with subqueryload.
```python
from sqlalchemy_sessionload import SessionRelationshipLoad
from project.model import Message, User
import sqlalchemy.orm as sa_orm
# assignment is needed
# otherwise instances are not saved in session
all_users = session.query(User).all()
# users connected to messages are now loaded from session
session_messages = (
session.query(Message)
.options(sa_orm.subqueryload(Message.user), SessionRelationshipLoad(Message.user))
.all()
)
```
## Benchmark
A benchmark is available [here](https://jvllmr.github.io/sqlalchemy-sessionload/dev/bench)
Raw data
{
"_id": null,
"home_page": null,
"name": "sqlalchemy-sessionload",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "sqlalchemy, session, loader",
"author": null,
"author_email": "Jan Vollmer <jan@vllmr.dev>",
"download_url": "https://files.pythonhosted.org/packages/c8/c4/824f88d7d86a2c2ec1218b97be60b8bdebe537accb3ae3d5f1f624ef22ae/sqlalchemy_sessionload-1.1.0.post2.tar.gz",
"platform": null,
"description": "# sqlalchemy-sessionload\n\n\n[](https://github.com/jvllmr/sqlalchemy-sessionload/blob/dev/LICENSE)\n[](https://app.codecov.io/gh/jvllmr/sqlalchemy-sessionload/tree/dev)\n[](https://github.com/jvllmr/sqlalchemy-sessionload/actions/workflows/test.yaml)\n\nSQLAlchemy load option that loads from persisted session instances.\n\nThe goal of this load option is to achieve performance gains in specific use-cases by not querying the database or serializing new objects and reading from cache instead. This means that you as a user need to make sure before that all of the objects you expect to find within a query are already present the session store. Use with care!\n\n## Basic usage\n\nSessionLoad is available for basic queries and relationship loading\n\nFilters and Order By constructs are also supported.\nIf you miss something you are invited to contribute.\n\nFor installation the plugin has to be registered:\n\n```python\nfrom sqlalchemy_sessionload import SQLAlchemySessionLoad\n\nSession = sessionmaker(...)\nSQLAlchemySessionLoad(Session)\n```\n\n### Simple Query\n\n```python\nfrom sqlalchemy_sessionload import SessionLoad\nfrom project.model import Message\n\n# assignment is needed\n# otherwise instances are not saved in session\nall_messages = session.query(Message).all()\n\nsession_messages = session.query(Message).options(SessionLoad(Message)).all()\n```\n\n### Load relationship\n\nJoined loading is currently only available with subqueryload.\n\n```python\nfrom sqlalchemy_sessionload import SessionRelationshipLoad\nfrom project.model import Message, User\nimport sqlalchemy.orm as sa_orm\n\n# assignment is needed\n# otherwise instances are not saved in session\nall_users = session.query(User).all()\n\n\n# users connected to messages are now loaded from session\nsession_messages = (\n session.query(Message)\n .options(sa_orm.subqueryload(Message.user), SessionRelationshipLoad(Message.user))\n .all()\n)\n```\n\n## Benchmark\n\nA benchmark is available [here](https://jvllmr.github.io/sqlalchemy-sessionload/dev/bench)\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Jan Vollmer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "SQLAlchemy load option that loads only from persisted session instances",
"version": "1.1.0.post2",
"project_urls": {
"Source": "https://github.com/jvllmr/sqlalchemy-sessionload"
},
"split_keywords": [
"sqlalchemy",
" session",
" loader"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c7187b005891b03cf6801e4967226b63e28f617e21d50b242b1d018ab2ca9642",
"md5": "28f7aafada9a5f82f8c51b21d062a7cc",
"sha256": "a9a9aa519c30798c4bb069b2bdb3eae412c40f2f3b769239c518084c9ea1624e"
},
"downloads": -1,
"filename": "sqlalchemy_sessionload-1.1.0.post2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "28f7aafada9a5f82f8c51b21d062a7cc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 9777,
"upload_time": "2025-10-16T18:47:05",
"upload_time_iso_8601": "2025-10-16T18:47:05.200057Z",
"url": "https://files.pythonhosted.org/packages/c7/18/7b005891b03cf6801e4967226b63e28f617e21d50b242b1d018ab2ca9642/sqlalchemy_sessionload-1.1.0.post2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c8c4824f88d7d86a2c2ec1218b97be60b8bdebe537accb3ae3d5f1f624ef22ae",
"md5": "5e3a27babc941242428abda2dfff7483",
"sha256": "e5e6eba38387914babf6d95f9e01114ffd69a28172e3c58bd9bb0f43ee869e66"
},
"downloads": -1,
"filename": "sqlalchemy_sessionload-1.1.0.post2.tar.gz",
"has_sig": false,
"md5_digest": "5e3a27babc941242428abda2dfff7483",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 11929,
"upload_time": "2025-10-16T18:47:06",
"upload_time_iso_8601": "2025-10-16T18:47:06.038387Z",
"url": "https://files.pythonhosted.org/packages/c8/c4/824f88d7d86a2c2ec1218b97be60b8bdebe537accb3ae3d5f1f624ef22ae/sqlalchemy_sessionload-1.1.0.post2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-16 18:47:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jvllmr",
"github_project": "sqlalchemy-sessionload",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sqlalchemy-sessionload"
}