Re: bytea quoting problems
Greg Landrum <[email protected]> Fri, 31 Oct 2003 16:45:27 -0800
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
At 10:04 AM 10/31/2003, Billy G. Allie wrote:
>Greg Landrum wrote:
>>
>>Greetings,
>>
>>I'm just getting starting with pyPgSQL (I'm in the process of switching
>>over from Interbase/Firebird) and I've hit some odd behavior with bytea
>>columns.
>>
>>I am trying to store pickles in bytea columns of a table and I appear to
>>be encountering problems in the quoting rules. Here's a session:
>>
>You need to tell pyPgSQL that you are inserting a bytea string. you can do
>this as follows:
>
>curs.execute('insert into throwaway values (%s)',
>PgBytea(cPickle.dumps(range(1,129))))I hope this answers your question.
It does, thanks for the help. I had assumed (incorrectly!) that the
adaptor would magically figure this stuff out for me. The PgBytea thing
does the trick though. Thanks!
-greg
----
greg Landrum ([email protected])
Software Carpenter/Computational Chemist
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/