Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Let us handle the boring stuff!

https://img.shields.io/badge/code%20style-black-000000.svg Maintainability

This extension provides a Connection and Session factory for SQLAlchemy to allow database connections to be configured via pyApp settings.

Engine instances are created from a singleton factory to ensure that connection pooling is utilised.

The extension also provides checks to confirm the settings are correct and that the application is able to connect to the database host.

Installation

Install using pip:

pip install pyapp-sqlalchemy

Install using pipenv:

pipenv install pyapp-sqlalchemy

Add pyapp_ext.sqlalchemy into the EXT list in your applications default_settings.py.

Add the DATABASE_ENGINES block into your runtime settings file:

DATABASE_ENGINES = {
    "default": {
        "url": "postgres://user:pass@host:port/database",
    },
}

Usage

The following example creates both Connection and Session instances:

from pyapp_ext.sqlalchemy import get_connection, get_session

# Get connection from default connection pool
cnn = get_connection()

# Get connection from an alternate pool
session = get_session("Alternate")

API

pyapp_ext.sqlalchemy.get_engine(default: str = None) -> Engine

Get named Engine instance (singleton)

pyapp_ext.sqlalchemy.get_connection(default: str = None) -> Connection

Get named Connection instance.

pyapp_ext.sqlalchemy.get_raw_connection(default: str = None)

Get named raw connection, this is the underlying Python DBAPI object.

pyapp_ext.sqlalchemy.get_session(default: str = None) -> Session

Get named Session instance.

Download files

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

Source Distribution

pyApp-SQLAlchemy-1.0b2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyApp_SQLAlchemy-1.0b2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pyApp-SQLAlchemy-1.0b2.tar.gz.

File metadata

  • Download URL: pyApp-SQLAlchemy-1.0b2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for pyApp-SQLAlchemy-1.0b2.tar.gz
Algorithm Hash digest
SHA256 819ce91831b69991cf6cc3baf5546f3bbfea9c5a3da765bf2934bbfe47f4eb06
MD5 f8564aa3e6b92a52557a13cafa1e70e5
BLAKE2b-256 d9fcee2358a077b7e0fc7379cfc3556eb86d3679bccc53e193b9966516d79206

See more details on using hashes here.

File details

Details for the file pyApp_SQLAlchemy-1.0b2-py3-none-any.whl.

File metadata

  • Download URL: pyApp_SQLAlchemy-1.0b2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for pyApp_SQLAlchemy-1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 24a71f71034d210461daef6cb578304747051f79a01d0aeb9eefae74553b3612
MD5 a1d1599b24cf22c0d4ae820013e440c5
BLAKE2b-256 f968faa0f19bf67d9109ab9cb9908fade610c531a25d16b0ad74dc3d429a99d8

See more details on using hashes here.

Supported by

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