[PyGreSQL] Newbie Questions

David M. Cook dave at davidcook.org
Sun Sep 12 21:58:24 EDT 2004


On Sun, Sep 12, 2004 at 09:32:46PM +1000, Ms Soo Chong wrote:

> Hmm..actually for the form, I have already used HTML to create it. My
> problem is I don't know how to approach the part to get python and pg module
> to response to the queries send by the user. What I was able to do is not

Try this CGI tutorial: 

  http://www.cs.virginia.edu/~lab2q/index.html

You need to prepare the SQL in a form like the following:

  fooquery = "select baz, quux from foo where baz=%(baz)s and quux=%(quux)s"

If you have the data in a dictionary then you just use this as::

  cursor.execute(fooquery, adict)
  column_names = [t[0] for t in cursor.description]
  rows = cursor.fetchall()
  
Dave Cook



Dave


More information about the PyGreSQL mailing list