473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

pygresql - bytea

Hello all,

I'm trying to use pygresql to insert binary data (type: bytea) into a
column (using postgresql, obviously).

To make a long story short: I can't get it to work. Not even by
cutting and pasting the very few examples I have found on the 'net.

Does _anyone_ have a working example? A simple insertion, and a
simple select is all I'm looking for.

--
Kind Regards,
Jan Danielsson
Te audire non possum. Musa sapientum fixa est in aure.
Apr 27 '06 #1
1 2510
Jan Danielsson wrote:
I'm trying to use pygresql to insert binary data (type: bytea) into a
column (using postgresql, obviously).
...
Does _anyone_ have a working example? A simple insertion, and a
simple select is all I'm looking for.


You should better ask such questions on the PyGreSQL mailing list.

Actually, you can insert and delete bytea data just as you would insert
and select ordinary string data, with the exception that you have to
escape the data before the insert, and unescape after select.

For instance, the string 'a\x00b' must be inserted as 'a\\000b'. As a
result from a select, you will get 'a\000b'.

The next PyGreSQL version will have functions for escaping and
unescaping on board (they are already checked in to CVS).

-- Christoph
May 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mPath Records | last post by:
Hello, I hope someone can help me with this problem - I'm getting nowhere fast and have been working on it for a week. All I'm trying to do is upload an image, store the image in a bytea...
1
by: Radu Stanciu | last post by:
Hi, I want to use the PygreSQL modules on a Windows machine (more exactly a WinXP one). I've downloaded the latest version (3.4 so far) and I am required to build the pgmodule C library. Is...
4
by: Chuck Amadi | last post by:
Hi all Anyone know a good Pygresql Tutorial for Interfacing between Python & Postgresql . Cheers Chuck
2
by: Neil Zanella | last post by:
Hello, I am using the following with python: The PyQt python bindings: http://www.riverbankcomputing.co.uk/pyqt/ based on the Qt GUI Application Framework:
2
by: Alvar Freude | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I want to change a column from text to bytea; since it seems that alter table can't change the column type, i have to add a temporary column...
0
by: Alvar Freude | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, the following I posted already on pgsql-bugs -- perhaps someone has a good workaround or fix or can say me that I'm wrong? There seems to...
4
by: David Garamond | last post by:
May I request that connectby() supports BYTEA keys too? My keys are GUID (16-byte stored in BYTEA). In this case, branch_delim does not make sense because the keys should be fixed-length anyway,...
7
by: C G | last post by:
Dear All, What's the best way to store jpgs in postgresql to use in a web page? I tried to use large objects, but how would you extract them from a table to be viewed in a web-page without...
4
by: Jerry LeVan | last post by:
Hi, I am adding image and large object support in my Cocoa postgresql browser. Are there going to be any enhanced bytea support functions coming along? It seems sorta silly to have to write...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.