Inserting record into postgresql database

M

Meszaros, Stacy

Hello all,

I am using python 2.6 and the psycopg2 module for the postgres connection
The following code is supposed to insert a record into a table with a byteafield. (bytearray)
I am having difficulty getting to field inserted properly. The snippet below inserts the first 8 bit hex value, which is 0xA5, correctly I believe - as \245
Not sure why, but the rest of the 'string' is not inserted into the db table.
Any ideas?

commandString = re.escape("A500046898000AC73D228B0B01800000000000000000000000000000000040003BF9")
insert = "INSERT INTO profile_commands(command_id, profile_id, execution_order, command, command_type) VALUES(%s, %s, 0, %s, 1); "
self.cur.execute(insert, (command_id, profileID,commandString,))
self.conn.commit()

Thanks for any ideas you can give me
Stacy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top