{"id":20534299,"url":"https://github.com/pyapp-org/pyapp.sqlalchemy","last_synced_at":"2025-07-08T19:39:01.224Z","repository":{"id":62578698,"uuid":"189052823","full_name":"pyapp-org/pyapp.sqlalchemy","owner":"pyapp-org","description":"🔌 SQLAlchemy extension","archived":false,"fork":false,"pushed_at":"2019-12-09T23:39:15.000Z","size":32,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T17:52:36.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyapp-org.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-28T15:14:39.000Z","updated_at":"2024-02-28T19:51:38.000Z","dependencies_parsed_at":"2022-11-03T21:00:26.457Z","dependency_job_id":null,"html_url":"https://github.com/pyapp-org/pyapp.sqlalchemy","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/pyapp-org/pyapp.sqlalchemy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyapp-org%2Fpyapp.sqlalchemy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyapp-org%2Fpyapp.sqlalchemy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyapp-org%2Fpyapp.sqlalchemy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyapp-org%2Fpyapp.sqlalchemy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyapp-org","download_url":"https://codeload.github.com/pyapp-org/pyapp.sqlalchemy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyapp-org%2Fpyapp.sqlalchemy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259905406,"owners_count":22929916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T00:26:09.263Z","updated_at":"2025-06-15T00:33:43.326Z","avatar_url":"https://github.com/pyapp-org.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"##################\npyApp - SQLAlchemy\n##################\n\n*Let us handle the boring stuff!*\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/ambv/black\n      :alt: Once you go Black...\n\n.. image:: https://api.codeclimate.com/v1/badges/0a86755f39f0416fbd1e/maintainability\n   :target: https://codeclimate.com/github/pyapp-org/pae.sqlalchemy/maintainability\n   :alt: Maintainability\n\nThis extension provides a `Connection` and `Session` factory for SQLAlchemy to\nallow database connections to be configured via pyApp settings. \n\n`Engine` instances are created from a singleton factory to ensure that \nconnection pooling is utilised.\n\nThe extension also provides checks to confirm the settings are correct and\nthat the application is able to connect to the database host.\n\n\nInstallation\n============\n\nInstall using *pip*::\n\n    pip install pyapp-sqlalchemy\n\nInstall using *pipenv*::\n\n    pipenv install pyapp-sqlalchemy\n\n\nAdd the `DATABASE_ENGINES` block into your runtime settings file::\n\n    DATABASE_ENGINES = {\n        \"default\": {\n            \"url\": \"postgres://user:pass@host:port/database\",\n        },\n    }\n\n\n.. note::\n\n    The URI is a defined by SQLAlchemy see the\n    `documentation \u003chttps://docs.sqlalchemy.org/en/13/core/engines.html\u003e`_. In addition to\n    the url any argument that can be provided to `sqlalchemy.engines.create_engine` can be\n    provided.\n\n\nUsage\n=====\n\nThe following example creates both `Connection` and `Session` instances::\n\n    from pyapp_ext.sqlalchemy import get_connection, get_session\n\n    # Get connection from default connection pool\n    cnn = get_connection()\n\n    # Get connection from an alternate pool\n    session = get_session(\"Alternate\")\n\n\nAPI\n===\n\n`pyapp_ext.sqlalchemy.get_engine(default: str = None) -\u003e Engine`\n\n    Get named `Engine` instance (singleton)\n\n\n`pyapp_ext.sqlalchemy.get_connection(default: str = None) -\u003e Connection`\n\n    Get named `Connection` instance.\n\n\n`pyapp_ext.sqlalchemy.get_raw_connection(default: str = None)`\n\n    Get named *raw* connection, this is the underlying Python DBAPI object.\n\n\n`pyapp_ext.sqlalchemy.get_session(default: str = None) -\u003e Session`\n\n    Get named `Session` instance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyapp-org%2Fpyapp.sqlalchemy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyapp-org%2Fpyapp.sqlalchemy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyapp-org%2Fpyapp.sqlalchemy/lists"}