database_wrapper for PostgreSQL database
Project description
database_wrapper
Part of the database_wrapper
package.
This python package is a database wrapper for PostgreSQL (also called pgsql) databases.
Installation
pip install database_wrapper[pgsql]
Usage
from database_wrapper_pgsql import AsyncPgSQLWithPooling, DBWrapperPgSQL
db = MySQL({
"hostname": "localhost",
"port": 3306,
"username": "root",
"password": "your_password",
"database": "my_database"
})
db.open()
dbWrapper = DBWrapperMySQL(db=db)
# Simple query
aModel = MyModel()
res = await dbWrapper.getByKey(
aModel,
"id",
3005,
)
if res:
print(f"getByKey: {res.toDict()}")
else:
print("No results")
# Raw query
res = await dbWrapper.getAll(
aModel,
"""
SELECT t1.*, t2.name AS other_name
FROM my_table AS t1
LEFT JOIN other_table AS t2 ON t1.other_id = t2.id
"""
)
async for record in res:
print(f"getAll: {record.toDict()}")
else:
print("No results")
db.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file database_wrapper_pgsql-0.1.28.tar.gz
.
File metadata
- Download URL: database_wrapper_pgsql-0.1.28.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d95601dfc0290f709ff782f8555d29b625250bcf1d1f389c7c0d423fe3e28f8f |
|
MD5 | 1f1cc6e54f9fd908037323b9f3c697ab |
|
BLAKE2b-256 | 2c17cf9efa7fa1da087daf2e4d8faca002d5ec7604325a20acfb110292d37ef8 |
Provenance
The following attestation bundles were made for database_wrapper_pgsql-0.1.28.tar.gz
:
Publisher:
master.yml
on gintsmurans/py_database_wrapper
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
database_wrapper_pgsql-0.1.28.tar.gz
- Subject digest:
d95601dfc0290f709ff782f8555d29b625250bcf1d1f389c7c0d423fe3e28f8f
- Sigstore transparency entry: 147601169
- Sigstore integration time:
- Predicate type:
File details
Details for the file database_wrapper_pgsql-0.1.28-py3-none-any.whl
.
File metadata
- Download URL: database_wrapper_pgsql-0.1.28-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9db91f4574172dbb4fe8a3e9fe305173fe3dfb1da448953edac2804b26bc57b |
|
MD5 | 1e1c2ac0b7baa5d6e7d1b18d0b3dbc06 |
|
BLAKE2b-256 | 5d7f8caf0a74affa1cc8fd2946db8bc11789ea8aa8df50bb4182ef4dc196b7bf |
Provenance
The following attestation bundles were made for database_wrapper_pgsql-0.1.28-py3-none-any.whl
:
Publisher:
master.yml
on gintsmurans/py_database_wrapper
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
database_wrapper_pgsql-0.1.28-py3-none-any.whl
- Subject digest:
d9db91f4574172dbb4fe8a3e9fe305173fe3dfb1da448953edac2804b26bc57b
- Sigstore transparency entry: 147601179
- Sigstore integration time:
- Predicate type: