1. Computing

Inserting Data Into a PostgreSQL Database

From , former About.com Guide

1 of 7

Psycopg: Install and Import

The module we will use for this tutorial is psycopg. It is available from http://www.initd.org/projects/psycopg1. So download it and install it using the directions that come with the package.

Once it is installed, you can import it like any other module:


# libs for database interface
import psycopg

If any of your fields require a date or time, you will also want to import the datetime module, which comes standard with Python.


import datetime

  1. About.com
  2. Computing
  3. Python
  4. Database Programming
  5. Python and PostgreSQL - Inserting Data Into a PostgreSQL Database

©2013 About.com. All rights reserved.