473,508 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python PostgreSQL API for BYTEA

2 New Member
I have to migrate a current PostgreSQL database to MSSQL. For doing this task I uses Python to create script for doing this task.

Now, I want to extract the data from the current PostgreSQL database, but I need a API. I decided to go with PSYCOPG2, but it seem to have a problem with the BYTEA datatype. I use these lines of code :

Expand|Select|Wrap|Line Numbers
  1. self.cursor.execute('SELECT * FROM electronicassembly WHERE id_pk = 2')        
  2. list = self.cursor.fetchall()
  3. print psycopg2.Binary(str(list[0][19]))
But it print me value like \\000\\0JEBF. I know that is suppose to be octal format, but character like JEBF is not "octal" and sometime (for other binary data) it is punctuaction character, like ';@ that are showed. So, do I miss something.... ??

Or, do you know another Python API that can handle BYTEA correctly ? Because, for MSSQL the binary for a BULK INSERT as to be in hexadecimal format.

Thanks

P-S : Sorry for my english, it is not my first language
Mar 8 '08 #1
0 1653

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3001
by: Juho Saarikko | last post by:
The program attached to this message makes the Python interpreter segfault randomly. I have tried both Python 2.2 which came with Debian Stable, and self-compiled Python 2.3.3 (newest I could find...
4
10070
by: Morten Goodwin Olsen | last post by:
Python, PostgreSQL and bytea Hi I am having a bit of trouble inserting images into a postgres database using python. The images should be stored in a bytea field. I have tried both with an odbc...
3
10566
by: bissatch | last post by:
Hi, I am wanting to learn how to store images in a postgreSQL database. I have got as far as uploading the file using a file/browse field on an html form and have been able to catch the file...
2
9275
by: bissatch | last post by:
Hi, I am trying to write script that is run when a form is submitted. The form contains an image input field and when submitted, the image is uploaded, resized and added as binary information to...
11
3545
by: G Lam | last post by:
Hi, I have some experience in MS Access 97 and 2000 and did write some application with them. Now, I want to learn PostgreSQL. I installed it on a RH8.0 server. Which books would you guys...
1
8128
by: Josué Maldonado | last post by:
Hello list, That's the question, what is the equivalent data type of the msSQL image data type ? TIA, -- Josué Maldonado.
0
1291
by: Marc G. Fournier | last post by:
Its been almost 4 weeks since PostgreSQL 7.4 was released, and, as with all new releases, several bugs have been identified as administrators migrate their production databases up from older...
6
3590
by: Tk421 | last post by:
I'm looking for a function that returns a md5 encryption for postgreSQL 7.3.4 I've found that this function exists on version 7.4, but I have had problems installing it on my Windows XP with...
0
1208
by: robintwos | last post by:
Hi Can anyone help me in knowing the equivalent Datatypes in DB2 for BYTEA, TEXT datatypes in PostGreSQL and Can I Create a ROLE in DB2 with a validity as in PostgreSQL Here is the...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
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
7323
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,...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5625
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,...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.