Yet another PostgreSQL database driver
Project description
Yet another Python PostgreSQL database driver.
Requirements
PostgreSQL 9.6+
Python 3.9+
Installation
use pip
$ pip install minipg
or
copy a module file.
$ cd $(SOMEWHERE_PYTHON_PATH) $ wget https://github.com/nakagami/minipg/raw/master/minipg.py
Example
import minipg
conn = minipg.connect(host='localhost',
user='postgres',
password='secret',
database='database_name')
cur = conn.cursor()
cur.execute('select foo, bar from baz')
for r in cur.fetchall():
print(r[0], r[1])
conn.close()
SSL Connection
You can make an SSL connection with an instance of SSLContext. Below is an example of an ssl connection without certificate validation.
import ssl
import minipg
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
conn = minipg.connect(host='localhost',
user='postgres',
password='secret',
database='database_name',
ssl_context=ssl_context)
Asyncio example
Please refer to the test code.
https://github.com/nakagami/minipg/blob/master/test_async.py
Restrictions and Unsupported Features
Supported Authentication METHOD are only ‘trust’, ‘md5’ and ‘scram-sha-256’.
Not full support for array data types.
For MicroPython
See https://github.com/nakagami/micropg . It’s a minipg subset driver.
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
minipg-0.11.0.tar.gz
(14.3 kB
view details)
File details
Details for the file minipg-0.11.0.tar.gz.
File metadata
- Download URL: minipg-0.11.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
255dbfbfcfc8fb6b58430257d779999d50bf12a453a7f22d683dde5f920f00e5
|
|
| MD5 |
d041b0a0800d72c79529fbca290cffce
|
|
| BLAKE2b-256 |
8b384e55e3fcf5cfe19096b93e0921647a1ae0d29e9db9f4003b7f3f237c485e
|