1. Home
  2. Computing & Technology
  3. Python

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

Explore Python
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. 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.