Storing a Python Dictionary in MySQL

J. Filici alaxsxaq at hotmail.com
Wed May 28 05:31:25 EDT 2003


alaxsxaq at hotmail.com (J. Filici) wrote in message news:<a6d7ff4e.0305271449.764c51cb at posting.google.com>...
> 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.
> 

I gave this some more thought last night and came up with two ways to
do this.

I could marshal the dictionary and store the binary representation or
I could convert the dictionary to an XML representation and store that
block of data.  For an XML representation, I'd still need to clean the
text data to ensure that no quotes are in the data.

Which is more efficient?

Is there any risk to marshal'ing the data; corruption?  changing
implementations?  The storage needs are short-term (6 months max), but
there is always the possibility of data corruption.

--JF




More information about the Python-list mailing list