Skip to main content

A PostgreSQL driver written in Golang for Python

Project description

pggo

Author: Lucas Lima Fernandes

PostgreSQL driver implemented in Go (pgx) exposed to Python via shared C lib, packaged as wheel.

Instalation

pip install pggo

Teste

from pggo import connect
c = connect("postgres://user:pass@host:5432/db?sslmode=disable")
cur = c.cursor()
cur.execute("select 1 as x")
print(cur.fetchall())  # [{'x': 1}]
c.close()

You can execute tests in examples/

Passing Parameters to Queries

pggo supports PostgreSQL positional parameters using the $1, $2, $n syntax. You must pass a list or tuple as the second argument to execute.

from pggo import connect

DSN = "postgres://postgres:password@localhost:5432/postgres?sslmode=disable"

with connect(DSN) as conn:
    with conn.cursor() as cur:
        cur.execute("INSERT INTO cliente (nome) VALUES ($1)", ["Lucas"])
        print("Rows affected:", cur.rowcount)

with connect(DSN) as conn:
    with conn.cursor() as cur:
        cur.execute("SELECT * FROM cliente WHERE nome = $1", ["Lucas"])
        print(cur.fetchall())  # [{'id': 2, 'nome': 'Lucas'}]

Contributing

Your contributions are welcome! If you encounter any bugs or have feature requests, please open an issue. To contribute code, follow these steps:

Fork the repository.

Clone your forked repository to your local machine.

Create a new branch for your feature or bugfix (git checkout -b feature-name).

Make your changes and commit them (git commit -m "Description of changes").

Push your branch (git push origin feature-name).

Open a pull request with a clear description of your changes.

For more details, check the Contributing Guide.

License This project is licensed under the MIT License. See the LICENSE file for more information.

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

pggo-1.2.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

pggo-1.2.0-py3-none-any.whl (6.2 MB view details)

Uploaded Python 3

File details

Details for the file pggo-1.2.0.tar.gz.

File metadata

  • Download URL: pggo-1.2.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pggo-1.2.0.tar.gz
Algorithm Hash digest
SHA256 58fc9676fe4f78b506e5425bd970a99f99842064de377fb539954bf135303899
MD5 a12163682f3d4d27dfe989ac275a6a10
BLAKE2b-256 6807a62f59d3389eb107fabb82a17e0ef7bf9363a0c6ffa962ed9917eb256a48

See more details on using hashes here.

Provenance

The following attestation bundles were made for pggo-1.2.0.tar.gz:

Publisher: auto-tag.yaml on lucaslimafernandes/pggo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pggo-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pggo-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pggo-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85221f20fbf7dc5097147286c8e20bf285e4c8247aad209e8402a6142f0aa6f9
MD5 aa2ee73c25028ee694d3a3acf6471b8d
BLAKE2b-256 5ed7014c0da83d609774285b33dfe3790a8500e5ebf7eb4672cf0ecfc6fbbd96

See more details on using hashes here.

Provenance

The following attestation bundles were made for pggo-1.2.0-py3-none-any.whl:

Publisher: auto-tag.yaml on lucaslimafernandes/pggo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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