{"id":13691053,"url":"https://github.com/litestar-org/litestar-asyncpg","last_synced_at":"2025-04-10T16:30:38.479Z","repository":{"id":197665351,"uuid":"699095510","full_name":"litestar-org/litestar-asyncpg","owner":"litestar-org","description":"Database connection management plugin for Litestar and asyncpg","archived":false,"fork":false,"pushed_at":"2025-02-27T13:19:52.000Z","size":325,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T23:51:24.259Z","etag":null,"topics":["asyncpg","litestar","litestar-api","litestar-framework"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/litestar-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["litestar-org"],"open_collective":"litestar","polar":"litestar-org"}},"created_at":"2023-10-01T22:32:32.000Z","updated_at":"2025-01-26T12:47:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb82ce9f-064b-4deb-a46b-2a8c3a9db594","html_url":"https://github.com/litestar-org/litestar-asyncpg","commit_stats":null,"previous_names":["cofin/litestar-asyncpg","litestar-org/litestar-asyncpg"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Flitestar-asyncpg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Flitestar-asyncpg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Flitestar-asyncpg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Flitestar-asyncpg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litestar-org","download_url":"https://codeload.github.com/litestar-org/litestar-asyncpg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248252691,"owners_count":21072699,"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":["asyncpg","litestar","litestar-api","litestar-framework"],"created_at":"2024-08-02T17:00:39.327Z","updated_at":"2025-04-10T16:30:38.123Z","avatar_url":"https://github.com/litestar-org.png","language":"Python","funding_links":["https://github.com/sponsors/litestar-org","https://opencollective.com/litestar","https://polar.sh/litestar-org"],"categories":["Resources"],"sub_categories":["Official Resources"],"readme":"\u003c!-- markdownlint-disable --\u003e\n\u003cp align=\"center\"\u003e\n  \u003c!-- github-banner-start --\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/litestar-org/branding/main/assets/Branding%20-%20SVG%20-%20Transparent/asyncPG%20-%20Banner%20-%20Inline%20-%20Light.svg#gh-light-mode-only\" alt=\"Litestar Logo - Light\" width=\"100%\" height=\"auto\" /\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/litestar-org/branding/main/assets/Branding%20-%20SVG%20-%20Transparent/asyncPG%20-%20Banner%20-%20Inline%20-%20Dark.svg#gh-dark-mode-only\" alt=\"Litestar Logo - Dark\" width=\"100%\" height=\"auto\" /\u003e\n  \u003c!-- github-banner-end --\u003e\n\u003c/p\u003e\n\u003c!-- markdownlint-restore --\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n\n| Project   |     | Status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n|-----------|:----|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| CI/CD     |     | [![Latest Release](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/publish.yml/badge.svg)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/publish.yml) [![ci](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/ci.yml/badge.svg)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/ci.yml) [![Documentation Building](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/docs.yml)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |\n| Quality   |     | [![Coverage](https://codecov.io/github/litestar-org/litestar-asyncpg/graph/badge.svg?token=vKez4Pycrc)](https://codecov.io/github/litestar-org/litestar-asyncpg) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg)                                                                                                    |\n| Package   |     | [![PyPI - Version](https://img.shields.io/pypi/v/litestar-asyncpg?labelColor=202235\u0026color=edb641\u0026logo=python\u0026logoColor=edb641)](https://badge.fury.io/py/litestar) ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/litestar?labelColor=202235\u0026color=edb641\u0026logo=python\u0026logoColor=edb641) ![Advanced Alchemy PyPI - Downloads](https://img.shields.io/pypi/dm/litestar-asyncpg?logo=python\u0026label=package%20downloads\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| Community |     | [![Reddit](https://img.shields.io/reddit/subreddit-subscribers/litestarapi?label=r%2FLitestar\u0026logo=reddit\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://reddit.com/r/litestarapi) [![Discord](https://img.shields.io/discord/919193495116337154?labelColor=202235\u0026color=edb641\u0026label=chat%20on%20discord\u0026logo=discord\u0026logoColor=edb641)](https://discord.gg/litestar) [![Matrix](https://img.shields.io/badge/chat%20on%20Matrix-bridged-202235?labelColor=202235\u0026color=edb641\u0026logo=matrix\u0026logoColor=edb641)](https://matrix.to/#/#litestar:matrix.org) [![Medium](https://img.shields.io/badge/Medium-202235?labelColor=202235\u0026color=edb641\u0026logo=medium\u0026logoColor=edb641)](https://blog.litestar.dev) [![Twitter](https://img.shields.io/twitter/follow/LitestarAPI?labelColor=202235\u0026color=edb641\u0026logo=twitter\u0026logoColor=edb641\u0026style=flat)](https://twitter.com/LitestarAPI) [![Blog](https://img.shields.io/badge/Blog-litestar.dev-202235?logo=blogger\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://blog.litestar.dev)                                                             |\n| Meta      |     | [![Litestar Project](https://img.shields.io/badge/Litestar%20Org-%E2%AD%90%20Advanced%20Alchemy-202235.svg?logo=python\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://github.com/litestar-org/litestar-asyncpg) [![types - Mypy](https://img.shields.io/badge/types-Mypy-202235.svg?logo=python\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://github.com/python/mypy) [![License - MIT](https://img.shields.io/badge/license-MIT-202235.svg?logo=python\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://spdx.org/licenses/) [![Litestar Sponsors](https://img.shields.io/badge/Sponsor-%E2%9D%A4-%23edb641.svg?\u0026logo=github\u0026logoColor=edb641\u0026labelColor=202235)](https://github.com/sponsors/litestar-org) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json\u0026labelColor=202235)](https://github.com/astral-sh/ruff) [![code style - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/format.json\u0026labelColor=202235)](https://github.com/psf/black) |\n\n\u003c/div\u003e\n# Litestar Asyncpg\n\nA barebones AsyncPG plugin for Litestar.  This plugin is useful for when you plan to use no ORM or need to manage the postgres connection separately.\n\n## Usage\n\n### Installation\n\n```shell\npip install litestar-asyncpg\n```\n\n### Example\n\nHere is a basic application that demonstrates how to use the plugin.\n\n```python\nfrom __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nfrom litestar import Controller, Litestar, get\nfrom litestar_asyncpg import AsyncpgConfig, AsyncpgPlugin, PoolConfig\n\nif TYPE_CHECKING:\n    from asyncpg import Connection\n\n\nclass SampleController(Controller):\n    @get(path=\"/sample\")\n    async def sample_route(self, db_connection: Connection) -\u003e dict[str, str]:\n        \"\"\"Check database available and returns app config info.\"\"\"\n        result = await db_connection.fetch(\"select 1\")\n        return {\"select_1\": str(result)}\n\n\nasyncpg = AsyncpgPlugin(config=AsyncpgConfig(pool_config=PoolConfig(dsn=\"postgresql://app:app@localhost:5432/app\")))\napp = Litestar(plugins=[asyncpg], route_handlers=[SampleController])\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitestar-org%2Flitestar-asyncpg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitestar-org%2Flitestar-asyncpg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitestar-org%2Flitestar-asyncpg/lists"}