cPickle and pgsql...damn!!

Peter Maas peter.maas at mplusr.de
Wed Jul 21 03:01:11 EDT 2004


Gerardo Herzig -Departamento de Proyectos Especiales e Internet- Facultad de Medicina schrieb:
>>print serializedDict
>>'}q\x01U\x03fooq\x03barq\x03s.'
>>pgconn.query('insert into TABLE values (%s)' % serializedDict)
>>result = pgconn.query('select * from TABLE').getresult()[0]
>>print result
>>'}qx01Ux03fooqx03barqx03s.'
> 
> And....voila!! There is not the same piece of crap!!

You can embed octal representations in an SQL string:
'insert into TABLE(key,val) values ('embeddednewline','line1\012line2')'

Mit freundlichen Gruessen,

Peter Maas

-- 
-------------------------------------------------------------------
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------



More information about the Python-list mailing list