1. Home
  2. Computing & Technology
  3. Python

Inserting Data Into a PostgreSQL Database

From Al Lukaszewski, for 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' '''

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 - Define the PostgreSQL Parameters for Python

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

All rights reserved.