Skip to main content

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)

Restrictions and Unsupported Features

  • Supported Authentication METHOD are only ‘trust’, ‘md5’ and ‘scram-sha-256’.

  • Not full support for array data types.

  • Not support for prepared statements.

For MicroPython

See https://github.com/nakagami/micropg . It’s a minipg subset driver.

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

minipg-0.9.0.tar.gz (10.2 kB view details)

Uploaded Source

File details

Details for the file minipg-0.9.0.tar.gz.

File metadata

  • Download URL: minipg-0.9.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for minipg-0.9.0.tar.gz
Algorithm Hash digest
SHA256 9cf4049238bafa5bb51f3413637c65a16216811ab7863862c72213ad3d0bcb92
MD5 cde1182d6cad9b6e9d586ea98ba097bb
BLAKE2b-256 dae3d51ef9add3bad39228942bea7bd553aebb794e54d0a5307f326c192227e6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page