String character encoding when converting data from one type/format to another

Dave Angel davea at davea.name
Wed Jan 7 08:56:56 EST 2015


On 01/07/2015 08:38 AM, Jacob Kruger wrote:
> Thanks.
>
> Makes more sense now, and yes, using 2.7 here.
>
> Unfortunately, while could pass the binary values into blob fields well
> enough, using forms of parameterised statements, the actual generation
> of sql script text files is a step they want to work with at times, if
> someone is handling this on site, so had to work first with generating
> string values, and then handle executing those statements against a
> MySQL server later on using MySQLdb.
>

There must be an encoding method used for describing blobs in an sql 
statement.  Use exactly that method;  don't try to get creative.

For example in sqlite, use  sqlite.encode()

-- 
DaveA



More information about the Python-list mailing list