DBAPI 2: PostgreSQL¶
DBAPI 2 Example: Postgres¶
Does not come with Python installation
Entry point:
connect()
Parameters best seen in the C-API documentation (http://www.postgresql.org/docs/8.3/static/libpq-connect.html)
connect(const char* conninfo)
: string containingname=value
pairs⟶ keyword arguments in
psycopg2
import psycopg2
connection = psycopg2.connect(
host='localhost',
dbname='schwammerldb',
user='ich',
password='secret')