Skip to main content

Yet another PostgreSQL database driver

Project description

Yet another Python PostgreSQL database driver.

Pure python or Cython http://cython.org/ accelaleted.

Requirements

  • Python 2.7, 3.3+, PyPy, jython 2.7, IronPython 2.7
  • Cython 0.22.x or higher optinally.

Installation

It can install as package or module.

Install as a package

$ pip install minipg

Install as a module

$ cd $(PROJECT_HOME)
$ wget https://github.com/nakagami/minipg/raw/master/minipg/minipg.py

Example

Query:

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()

COPY TO:

import minipg
conn = minipg.connect(host='localhost',
                    user='postgres',
                    password='secret',
                    database='database_name')
f = open('foo.txt', 'bw')
conn.execute('COPY foo_table TO stdout', f)
f.close()
conn.close()

COPY FROM:

import minipg
conn = minipg.connect(host='localhost',
                    user='postgres',
                    password='secret',
                    database='database_name')
f = open('foo.txt', 'br')
conn.execute('COPY foo_table FROM stdin', f)
f.close()
conn.close()

Execute Query from a command line

$ python -m minipg -H pg_server -U user -W pass -D db_name <<EOS
> SELECT * FROM FOO
> EOS

or

$ python -m minipg -H pg_server -U user -W pass -D db_name -Q 'SELECT * FROM FOO'

Restrictions and Unsupported Features

  • Authentication METHOD only can ‘trust’ or ‘md5’ in pg_hba.conf.
  • Not full support for array data types.
  • Not support for prepared statements.

Project details


Release history Release notifications

History Node

0.6.2

History Node

0.6.1

History Node

0.6.0

History Node

0.5.8

History Node

0.5.7

History Node

0.5.6

History Node

0.5.5

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

This version
History Node

0.5.1

History Node

0.5.0

History Node

0.4.5

History Node

0.4.4

History Node

0.4.3

History Node

0.4.2

History Node

0.4.1

History Node

0.4.0

History Node

0.3.8

History Node

0.3.7

History Node

0.3.6

History Node

0.3.5

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.9

History Node

0.2.8

History Node

0.2.7

History Node

0.2.6

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.1

History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
minipg-0.5.1.tar.gz (124.9 kB) Copy SHA256 hash SHA256 Source None May 1, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page