Revision 6 as of 2007-10-07 03:00:51

Clear message
task postgresql
create database createdb mydb
command-line tool psql -d mydb
GUI tool pgadmin3
install module easy_install psycopg2
import from psycopg2 import *
connect conn = connect("dbname='testdb' user='me' host='localhost' password='mypassword'”)
get cursor curs = conn.cursor()
execute SELECT curs.execute('SELECT * FROM tbl')
fetch curs.fetchone(); curs.fetchall(); curs.fetchmany()
use bind variables curs.execute('SELECT * FROM tbl WHERE col = %(varnm)s', {'varnm':22})
commit conn.commit() (required)

Unable to edit the page? See the FrontPage for instructions.