Skip to main content

Helper for easily connect to multiple databases.

Project description

sqlalchemy-multiple-db

CI codecov pypi downloads versions 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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy-multiple-db-1.1.0.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

sqlalchemy_multiple_db-1.1.0-py3-none-any.whl (8.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page