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)

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


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.10.1.tar.gz (13.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: minipg-0.10.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18

File hashes

Hashes for minipg-0.10.1.tar.gz
Algorithm Hash digest
SHA256 d77802ba60f5d6560d3d1c37373d5d5a9f3622c62e406b72cbb16bc914e9b7cd
MD5 0d99fc109beee8155097f900f46a0015
BLAKE2b-256 59f264fc7fc0fa7c71e26151ff2c3dc6439245b36427ed98dac018d8ccc757d7

See more details on using hashes here.

Supported by

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