# sqlalchemy-multiple-db
[![CI](https://github.com/bigbag/sqlalchemy-multiple-db/workflows/CI/badge.svg)](https://github.com/bigbag/sqlalchemy-multiple-db/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/bigbag/sqlalchemy-multiple-db/branch/main/graph/badge.svg)](https://codecov.io/gh/bigbag/sqlalchemy-multiple-db)
[![pypi](https://img.shields.io/pypi/v/sqlalchemy-multiple-db.svg)](https://pypi.python.org/pypi/sqlalchemy-multiple-db)
[![downloads](https://img.shields.io/pypi/dm/sqlalchemy-multiple-db.svg)](https://pypistats.org/packages/sqlalchemy-multiple-db)
[![versions](https://img.shields.io/pypi/pyversions/sqlalchemy-multiple-db.svg)](https://github.com/bigbag/sqlalchemy-multiple-db)
[![license](https://img.shields.io/github/license/bigbag/sqlalchemy-multiple-db.svg)](https://github.com/bigbag/sqlalchemy-multiple-db/blob/master/LICENSE)
**sqlalchemy-multiple-db** helper for easily connect to multiple databases.
## Installation
sqlalchemy-multiple-db is available on PyPI.
Use pip to install:
$ pip install sqlalchemy-multiple-db
## Basic Usage
```py
from sqlalchemy_multiple_db import DBConfig, db
db.setup({"test1": DBConfig(dsn="sqlite://"), "test2": DBConfig(dsn="sqlite://")})
with db.session_scope("test1") as session:
assert session.execute("select 1;")
with db.session_scope("test2") as session:
assert session.execute("select 1;")
db.shutdown()
db.setup(DBConfig(dsn="sqlite://"))
with db.session_scope() as session:
assert session.execute("select 1;")
db.shutdown()
```
## License
sqlalchemy-multiple-db is developed and distributed under the Apache 2.0 license.
## Reporting a Security Vulnerability
See our [security policy](https://github.com/bigbag/sqlalchemy-multiple-db/security/policy).
Raw data
{
"_id": null,
"home_page": "https://github.com/bigbag/sqlalchemy-multiple-db",
"name": "sqlalchemy-multiple-db",
"maintainer": "Pavel Liashkov",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "pavel.liashkov@protonmail.com",
"keywords": "",
"author": "Pavel Liashkov",
"author_email": "pavel.liashkov@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/3b/574f0e416b351203fa43bf70f852f66ce01714450a05f58d9b33f0007311/sqlalchemy-multiple-db-2.0.0.tar.gz",
"platform": "POSIX",
"description": "# sqlalchemy-multiple-db\n\n[![CI](https://github.com/bigbag/sqlalchemy-multiple-db/workflows/CI/badge.svg)](https://github.com/bigbag/sqlalchemy-multiple-db/actions?query=workflow%3ACI)\n[![codecov](https://codecov.io/gh/bigbag/sqlalchemy-multiple-db/branch/main/graph/badge.svg)](https://codecov.io/gh/bigbag/sqlalchemy-multiple-db)\n[![pypi](https://img.shields.io/pypi/v/sqlalchemy-multiple-db.svg)](https://pypi.python.org/pypi/sqlalchemy-multiple-db)\n[![downloads](https://img.shields.io/pypi/dm/sqlalchemy-multiple-db.svg)](https://pypistats.org/packages/sqlalchemy-multiple-db)\n[![versions](https://img.shields.io/pypi/pyversions/sqlalchemy-multiple-db.svg)](https://github.com/bigbag/sqlalchemy-multiple-db)\n[![license](https://img.shields.io/github/license/bigbag/sqlalchemy-multiple-db.svg)](https://github.com/bigbag/sqlalchemy-multiple-db/blob/master/LICENSE)\n\n**sqlalchemy-multiple-db** helper for easily connect to multiple databases.\n\n\n## Installation\n\nsqlalchemy-multiple-db is available on PyPI.\nUse pip to install:\n\n $ pip install sqlalchemy-multiple-db\n\n## Basic Usage\n```py\nfrom sqlalchemy_multiple_db import DBConfig, db\n\ndb.setup({\"test1\": DBConfig(dsn=\"sqlite://\"), \"test2\": DBConfig(dsn=\"sqlite://\")})\n\nwith db.session_scope(\"test1\") as session:\n assert session.execute(\"select 1;\")\n\nwith db.session_scope(\"test2\") as session:\n assert session.execute(\"select 1;\")\n\ndb.shutdown()\n\ndb.setup(DBConfig(dsn=\"sqlite://\"))\n\nwith db.session_scope() as session:\n assert session.execute(\"select 1;\")\n\ndb.shutdown()\n\n```\n\n## License\n\nsqlalchemy-multiple-db is developed and distributed under the Apache 2.0 license.\n\n## Reporting a Security Vulnerability\n\nSee our [security policy](https://github.com/bigbag/sqlalchemy-multiple-db/security/policy).\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "Helper for easily connect to multiple databases.",
"version": "2.0.0",
"project_urls": {
"Download": "https://pypi.python.org/pypi/sqlalchemy-multiple-db",
"Homepage": "https://github.com/bigbag/sqlalchemy-multiple-db"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e62d469db4cf4fca374ba3ba34c19fb549b1f2c938fe14f72c45ee1a1b15d924",
"md5": "dec2f8fdcd40619c17699935e19feab0",
"sha256": "4f2b25238f37629ded364db3185e511bf865def96f916b3a2d2e5e4db4afa333"
},
"downloads": -1,
"filename": "sqlalchemy_multiple_db-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dec2f8fdcd40619c17699935e19feab0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 8782,
"upload_time": "2023-08-03T10:50:08",
"upload_time_iso_8601": "2023-08-03T10:50:08.932357Z",
"url": "https://files.pythonhosted.org/packages/e6/2d/469db4cf4fca374ba3ba34c19fb549b1f2c938fe14f72c45ee1a1b15d924/sqlalchemy_multiple_db-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c03b574f0e416b351203fa43bf70f852f66ce01714450a05f58d9b33f0007311",
"md5": "4789182dfea9d5a92228c7b5f16a5d38",
"sha256": "9c33b87a2d5cfcc0c8c92693c52009d61cc69962cbda1a447795a565c3d5fbff"
},
"downloads": -1,
"filename": "sqlalchemy-multiple-db-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "4789182dfea9d5a92228c7b5f16a5d38",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7848,
"upload_time": "2023-08-03T10:50:09",
"upload_time_iso_8601": "2023-08-03T10:50:09.892774Z",
"url": "https://files.pythonhosted.org/packages/c0/3b/574f0e416b351203fa43bf70f852f66ce01714450a05f58d9b33f0007311/sqlalchemy-multiple-db-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-03 10:50:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bigbag",
"github_project": "sqlalchemy-multiple-db",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "sqlalchemy-multiple-db"
}