problem with quoted strings while inserting into varchar field of database.

krishnakant Mane researchbase at gmail.com
Sun May 6 14:02:42 EDT 2007


hello,
I finally got some code to push a pickled list into a database table.
but now the problem is technically complex although possible to solve.
the problem is that I can nicely pickle and store lists in a blob
field with the help of dumps() for picklling into a string and then
passing the string to the blob.
I am also able to get back the string safely and do a loads() to
unpickle the object.
but this only works when list contains numbers.
if there is a list such als
lst = ["a","b","c"] then after a dumpls I get a pickled object into a
string but when I try to insert this into the blob field it refuses to
get into the table.
there is an sql syntax error.
I further discovered that the string variable that contains the
pickled object contains a lot of single quots "'" and this is what is
probably preventing the sql insert from succedding.  can some one
suggest how to work around this problem?
regards,
Krishnakant.



More information about the Python-list mailing list