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 ?
asked Apr 26, 2017 at 8:41
Fedour
3871 gold badge3 silver badges20 bronze badges
-
So what do you actually want to insert into the database?Daniel Roseman– Daniel Roseman2017年04月26日 08:43:32 +00:00Commented 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?juanpa.arrivillaga– juanpa.arrivillaga2017年04月26日 08:43:39 +00:00Commented 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")Fedour– Fedour2017年04月26日 08:44:39 +00:00Commented Apr 26, 2017 at 8:44
-
All fields are String fieldsFedour– Fedour2017年04月26日 08:46:40 +00:00Commented Apr 26, 2017 at 8:46
-
Are you in Python 3 or 2?juanpa.arrivillaga– juanpa.arrivillaga2017年04月26日 08:59:45 +00:00Commented Apr 26, 2017 at 8:59
lang-py