Skip to main content

fastasyncpg

Installation

Install latest from pypi

$ pip install fastasyncpg

How to use

Create one Database at import time, and connect it at app startup:

from fastasyncpg.core import Database

db = Database()          # module-level singleton, importable everywhere

async def startup(): await db.connect(database='mydb')

Queries run through the pool by default. transaction (and acquire) make a single connection current for the running task via a ContextVar, so everything inside the block – including table helpers and code called indirectly – joins the transaction, with no handle-passing:

async with db.transaction():
    await db.execute('SELECT 1 FROM "user" WHERE id=$1 FOR UPDATE', uid)
    await db.t.user.update(pk_values=[uid], credits=100)

See the API docs for table access (db.t), auto-generated dataclasses, queue helpers (claim_one), and more.

Download files

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

Source Distribution

fastasyncpg-0.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

fastasyncpg-0.1.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file fastasyncpg-0.1.0.tar.gz.

File metadata

  • Download URL: fastasyncpg-0.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for fastasyncpg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1f770d9036963d64d2c17814b12765c3ab19c84562ba1bc2ce393648bfcae355
MD5 0b6834176c2fa3c334098c37b6d73ae9
BLAKE2b-256 5eb8a7c5b071d297998a8628f7198b9e2ce04a8c3e24e2544628ab374da91eee

See more details on using hashes here.

File details

Details for the file fastasyncpg-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fastasyncpg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for fastasyncpg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c6124c03a049adeed0a8b36d3a39e578128c87ec7a58be5e96ebf234c928344
MD5 848caeea3eb7e90cfaee26873afc6f97
BLAKE2b-256 ef9ab7887c9766154288bc01ccc30e83ece8b9b2f2f2677d3e88a6da6e915e49

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