Skip to main content

PostgreSQL client for Trio based on asyncpg

Project description

Automated test status (Linux and MacOS) Automated test status (Windows) Test coverage

triopg

Welcome to triopg!

PostgreSQL client for Trio based on asyncpg

License: Your choice of MIT or Apache License 2.0

Quick example:

import trio_asyncio
import triopg


async def main():
    async with triopg.connect() as conn:

        await conn.execute(
            """
            DROP TABLE IF EXISTS users;
            CREATE TABLE IF NOT EXISTS users (
                _id SERIAL PRIMARY KEY,
                user_id VARCHAR(32) UNIQUE
            )"""
        )

        async with conn.transaction():
            await conn.execute("INSERT INTO users (user_id) VALUES (1)")
            await conn.execute("INSERT INTO users (user_id) VALUES (2)")
            await conn.execute("INSERT INTO users (user_id) VALUES (3)")

        print(await conn.fetch("SELECT * FROM users"))


trio_asyncio.run(main)

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

triopg-0.5.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

triopg-0.5.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file triopg-0.5.0.tar.gz.

File metadata

  • Download URL: triopg-0.5.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for triopg-0.5.0.tar.gz
Algorithm Hash digest
SHA256 fe485c6f3aba703577397843b14cd91e389a5b13e9736d7449ee2bd41d0a960d
MD5 a2290af40dd2cfc312aa9f5f906e93f9
BLAKE2b-256 e915c51c7b503ab9e9b9a8a56274071b1524c676f43cd9750a9d65c931cf0da8

See more details on using hashes here.

File details

Details for the file triopg-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: triopg-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for triopg-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71096987b443281a16aff3f6750daafbfc64758598d0016116b65a363b41b78f
MD5 b08a84be2812f8f0a6967562e4cf0ae8
BLAKE2b-256 538affb1729393ccdad847bada2487bdbd26ae9303a863977b7369da85d5de3c

See more details on using hashes here.

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