Storing a Python Dictionary in MySQL

J. Filici alaxsxaq at hotmail.com
Tue May 27 18:49:55 EDT 2003


I have written a CGI utility that collects form data into a MySQL
database for persistent storage.  The program is written in such a way
that it can be called by any form with any number of fields.  The
present version takes each form post and expands it into a series of
sql statements that insert each form value into the database as
separate rows.   The form post 'record' can be reassembled when the
data is extracted later based on the form id and record timestamp.

In planning for improvements to this utility, I'm looking at a better
way to store the form data.  My utility builds a dictionary from the
form input field names and values and I'm thinking that I could just
store that dictionary in a clob field in MySQL.  What's the best way
to do this?  I need to be able to store the entire dictionary for each
form post without concern about the characters coming in - textareas.

--JF




More information about the Python-list mailing list