<h1><code>init-provider-sqlalchemy</code></h1>
Database provider implemented using [`init-provider`](https://github.com/vduseev/init-provider).




Table of Contents
- [Quick start](#quick-start)
- [Installation](#installation)
- [License](#license)
## Quick start
Below is a full runnable example that uses everything in this library.
```python
import asyncio
import os
from init_provider import setup, dispose
from init_provider_sqlalchemy import Database
from sqlalchemy import text
@setup
def configure() -> None:
os.environ["DATABASE_ENGINE_URL"] = "sqlite:///example.db"
os.environ["DATABASE_ENGINE_ASYNC_URL"] = "sqlite+aiosqlite:///example.db"
os.environ["DATABASE_ENGINE_ECHO"] = "False"
os.environ["DATABASE_SESSION_EXPIRE_ON_COMMIT"] = "False"
@dispose
def cleanup() -> None:
os.unlink("example.db")
def sync_test() -> None:
with Database.session() as session:
result = session.execute(text("SELECT 1"))
print(result.scalar())
async def async_test() -> None:
async with Database.async_session() as session:
result = await session.execute(text("SELECT 1"))
print(result.scalar())
async def main() -> None:
sync_test()
await async_test()
if __name__ == "__main__":
asyncio.run(main())
```
## Installation
Using `pip`:
```shell
pip install init-provider-sqlalchemy
```
Using `uv`:
```shell
uv add init-provider-sqlalchemy
```
## License
Licensed under the [Apache-2.0 License](./LICENSE).
Raw data
{
"_id": null,
"home_page": null,
"name": "init-provider-sqlalchemy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "vduseev <vagiz@duseev.com>",
"keywords": "database, postgres, provider, service, singleton",
"author": null,
"author_email": "vduseev <vagiz@duseev.com>",
"download_url": "https://files.pythonhosted.org/packages/de/cf/372585c9c0609a2d73232bd5b759d22c3ade816a7fe170e29791b20c0632/init_provider_sqlalchemy-0.1.1.tar.gz",
"platform": null,
"description": "<h1><code>init-provider-sqlalchemy</code></h1>\n\nDatabase provider implemented using [`init-provider`](https://github.com/vduseev/init-provider).\n\n\n\n\n\n\nTable of Contents\n\n- [Quick start](#quick-start)\n- [Installation](#installation)\n- [License](#license)\n\n## Quick start\n\nBelow is a full runnable example that uses everything in this library.\n\n```python\nimport asyncio\nimport os\nfrom init_provider import setup, dispose\nfrom init_provider_sqlalchemy import Database\nfrom sqlalchemy import text\n\n\n@setup\ndef configure() -> None:\n os.environ[\"DATABASE_ENGINE_URL\"] = \"sqlite:///example.db\"\n os.environ[\"DATABASE_ENGINE_ASYNC_URL\"] = \"sqlite+aiosqlite:///example.db\"\n os.environ[\"DATABASE_ENGINE_ECHO\"] = \"False\"\n os.environ[\"DATABASE_SESSION_EXPIRE_ON_COMMIT\"] = \"False\"\n\n\n@dispose\ndef cleanup() -> None:\n os.unlink(\"example.db\")\n\n\ndef sync_test() -> None:\n with Database.session() as session:\n result = session.execute(text(\"SELECT 1\"))\n print(result.scalar())\n\n\nasync def async_test() -> None:\n async with Database.async_session() as session:\n result = await session.execute(text(\"SELECT 1\"))\n print(result.scalar())\n\n\nasync def main() -> None:\n sync_test()\n await async_test()\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\n## Installation\n\nUsing `pip`:\n\n```shell\npip install init-provider-sqlalchemy\n```\n\nUsing `uv`:\n\n```shell\nuv add init-provider-sqlalchemy\n```\n\n## License\n\nLicensed under the [Apache-2.0 License](./LICENSE).",
"bugtrack_url": null,
"license": null,
"summary": "SQLAlchemy provider for init-provider",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://github.com/vduseev/init-provider-sqlalchemy",
"Homepage": "https://github.com/vduseev/init-provider-sqlalchemy",
"Issues": "https://github.com/vduseev/init-provider-sqlalchemy/issues",
"Repository": "https://github.com/vduseev/init-provider-sqlalchemy"
},
"split_keywords": [
"database",
" postgres",
" provider",
" service",
" singleton"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e3860b40077a82d1af15d1b0f5b69ec92e3bc040d1befbdd45fbe0efec2a691f",
"md5": "8ca9e5b858e189aeb5e6d0a8e8dd3f46",
"sha256": "d7d653125942b65b3ff8d628b9d6d8227e3858191126da16a02581ebfd410434"
},
"downloads": -1,
"filename": "init_provider_sqlalchemy-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8ca9e5b858e189aeb5e6d0a8e8dd3f46",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 7619,
"upload_time": "2025-10-12T21:32:37",
"upload_time_iso_8601": "2025-10-12T21:32:37.948804Z",
"url": "https://files.pythonhosted.org/packages/e3/86/0b40077a82d1af15d1b0f5b69ec92e3bc040d1befbdd45fbe0efec2a691f/init_provider_sqlalchemy-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "decf372585c9c0609a2d73232bd5b759d22c3ade816a7fe170e29791b20c0632",
"md5": "5c7c2692cc8336ca37623295fdecb59c",
"sha256": "039224fd7aa3cedb3ae6476ee56358538e7609e581757c1acd27e81bf384e0e5"
},
"downloads": -1,
"filename": "init_provider_sqlalchemy-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "5c7c2692cc8336ca37623295fdecb59c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 62169,
"upload_time": "2025-10-12T21:32:39",
"upload_time_iso_8601": "2025-10-12T21:32:39.510437Z",
"url": "https://files.pythonhosted.org/packages/de/cf/372585c9c0609a2d73232bd5b759d22c3ade816a7fe170e29791b20c0632/init_provider_sqlalchemy-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-12 21:32:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vduseev",
"github_project": "init-provider-sqlalchemy",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "init-provider-sqlalchemy"
}