加载中...

Python

  1. Home
  2. Computing & Technology
  3. Python

Inserting Data Into a PostgreSQL Database

By Al Lukaszewski, 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

1 of 7

Explore Python

More from About.com

Python

  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.