1. Home
  2. Computing & Technology
  3. Python

Inserting Data Into a PostgreSQL Database

From Al Lukaszewski, for About.com

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

Explore Python
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Python
  4. Database Programming
  5. Python and PostgreSQL - Inserting Data Into a PostgreSQL Database

©2009 About.com, a part of The New York Times Company.

All rights reserved.