A Python wrapper for PostgreSQL interaction using a C extension
Project description
Simple Python Wrapper for postgres connection.
Table of Contents
- Table of Contents
- Overview
- Features
- Project Structure
- Getting Started
- Roadmap
- Contributing
- License
- Acknowledgments
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
withblocks 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:
-
Clone the repository:
❯ git clone https://github.com/pedrohsbarbosa99/dxpq
-
Navigate to the project directory:
❯ cd dxpq
-
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
- 💬 Join the Discussions: Share your insights, provide feedback, or ask questions.
- 🐛 Report Issues: Submit bugs found or log feature requests for the
dxpqproject. - 💡 Submit Pull Requests: Review open PRs, and submit your own PRs.
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/pedrohsbarbosa99/dxpq
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to github: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
License
Dxpq is protected under the MIT License. For more details, refer to the LICENSE file.
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
File details
Details for the file dxpq-0.0.6.tar.gz.
File metadata
- Download URL: dxpq-0.0.6.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fe0fd0d510cc5fa3f5cef6e36ab5d3445ccd0bec0d5c1d6f557f055875579ba
|
|
| MD5 |
f9120e48047ce8f02e2d060ecc445b3f
|
|
| BLAKE2b-256 |
201120982b34ec1376b1b1d8c99a282875f2c21aa081358c4ea98b5dc3365580
|