Skip to main content
Project Logo

Simple Python Wrapper for postgres connection.

license last-commit repo-top-language repo-language-count


Table of Contents


Overview

dxpq is a simple and intuitive Python library designed to facilitate connection and interaction with PostgreSQL databases. It was created with the goal of providing an efficient way to perform common PostgreSQL operations, such as executing SQL queries, inserting and updating data, and managing transactions.

This library is lightweight and easy to use, allowing developers to quickly connect to the database without the complexity of setting up additional packages. With support for basic SQL commands and transactions, dxpq offers a clear and straightforward interface for working with PostgreSQL.

Ideal for those seeking a minimalist solution focused only on essential database operations, dxpq is perfect for projects that don't require large frameworks or heavy libraries but still need robust communication with PostgreSQL.


Features

  • Database Connection: Easily establish a connection to a PostgreSQL database using a connection string.

  • Cursor Management: Create and manage cursors for executing SQL queries. Fetch all results or a single row, with support for different result formats (e.g., dictionary-style results).

  • SQL Execution: Execute SQL queries and commands with parameters for secure and dynamic query building.

  • Context Manager Support: The library supports context manager functionality, allowing the use of connections and cursors in with blocks for automatic resource management.

  • Cursor Types: Supports different cursor types, such as dictionary-style results, for easier access to columns by name.

  • Clean Resource Management: Automatically close database connections and cursors when done, either through context management or explicit cleanup with close() and __del__ methods.


Project Structure

└── dxpq/
    ├── README.md
    ├── dxpq
    │   ├── __init__.py
    │   ├── connection.py
    │   └── cursor.py
    ├── pyproject.toml
    ├── requirements-dev.txt
    └── requirements.txt

Getting Started

Prerequisites

This project requires the following dependencies:

  • Programming Language: Python
  • Package Manager: Pip

Installation

Build dxpq from the source and intsall dependencies:

  1. Clone the repository:

    ❯ git clone https://github.com/pedrohsbarbosa99/dxpq
    
  2. Navigate to the project directory:

    ❯ cd dxpq
    
  3. Install the dependencies: Using https://pypi.org/project/pip:

    ❯ pip install -r requirements.txt, requirements-dev.txt
    

Usage

Run the project with:

Using pip:

pip install dxpq
import dxpq

connection = dxpq.Connection("postgresql://postgres:postgres@localhost:5432/postgres")
with connection.cursor() as cursor:
    cursor.execute("select 1")
    cursor.fetchall()

Testing

Under development


Roadmap

  • Transaction support: Implement support to SQL commands

Contributing

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your github account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/pedrohsbarbosa99/dxpq
    
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
    
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
    
  6. Push to github: Push the changes to your forked repository.
    git push origin new-feature-x
    
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph


License

Dxpq is protected under the MIT License. For more details, refer to the LICENSE file.



Metadata

Release files for dxpq 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dxpq 0.0.7
File Size Uploaded Provenance Actions
dxpq-0.0.7.tar.gz 5.6 kB Without provenance Details for dxpq-0.0.7.tar.gz

Release files / dxpq-0.0.7.tar.gz

Download URL dxpq-0.0.7.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
577d7eef995fcc60d8e90ae5507715108c82bc175b3d1b736395b6adb755dc28
BLAKE2b-256 checksum
How to use checksums
51dc4f2364b3d2c761214b948334ddaa98d3a1aac4f183a54bc0bcde9eb384da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for dxpq 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page