0

I have an array containing SQL query result. I need to convert this array in tuple to make a request like this:

t = tuple(data)
querysring="INSERT INTO %s VALUES %s "%(table,t)
cur.execute(querysring)

But my array contains values like ['François','données'] and when I convert this in tuple it's make and insert 'Fran\xc3\xa7ois' in my database.

I have try to decode and encode (utf-8) but it seem not working.

Any suggestions ?

6
  • So what do you actually want to insert into the database? Commented Apr 26, 2017 at 8:43
  • What sort of RDBMS are you working with? What sort of field are you tring to insert into? What do you expect to insert? Commented Apr 26, 2017 at 8:43
  • I use Postgresql. And I want to insert someting like this: "Insert Into AGENT values ("bock","François","Individual"). But it make that: "Insert Into AGENT values ("bock","Fran\xc3\xa7ois","Individual") Commented Apr 26, 2017 at 8:44
  • All fields are String fields Commented Apr 26, 2017 at 8:46
  • Are you in Python 3 or 2? Commented Apr 26, 2017 at 8:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.