1. Home
  2. Computing & Technology
  3. Python

Inserting Data Into a PostgreSQL Database

From , former About.com Guide

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

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

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

All rights reserved.