1. Home
  2. Computing & Technology
  3. Python

Inserting Data Into a PostgreSQL Database

By Al Lukaszewski, About.com

6 of 7

Define the Parameters

You will notice that we have three variables in our statement: table, columns, and values. These thus become the parameters with which the function is called:

def insert(table, columns, values):

We should, of course, follow that with a doc string:

'''Function to insert the form data 'values' into table 'table' according to the columns in 'column' '''

6 of 7

Explore Python

More from About.com

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

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

All rights reserved.