Postgres BYTEA problems

Steve smithwis at colorado.edu
Wed Mar 3 16:05:46 EST 2004


I've searched throughout the python website and can't find an answer.

My problem:
After getting a BYTEA from a postgres database using Pygresql call:
[code]
x = Db.query("SELECT seq FROM sequence \
              WHERE version = \'NT_004350.16\' \
              AND startloc = 1 \
              AND endloc = 1120")
y = x.getresult()[0][1]
[/code]
'y' ends up containing a string of characters.  THe problem is that
many of these characters should be escaped characters.  However,
somewhere in the process the escape character itself is interpreted as
a character that must be escaped.
so if I should be getting
"\x00\x01"
I'll get
"\\x00\\x01"

My Thoughts:
1) Is there a way to somehow get a 'raw' uninterpreted input to the
string?
2) Can I possibly get the BYTEA results back as one very long Long?
3) I can just accept that this is the way I'm going to get my results
and try to convert the the string into something more usable.
   -Any ideas how I might go about doing this?

Thanks for any help you can provide.

--Steve



More information about the Python-list mailing list