I use python to connect to my postgresql database. I parse a XML fill to populate my base, so I have an array[] of values for one line to insert. I have something like this:
cur.execute("""INSERT INTO ACTIVITYDESC VALUES (%s,%s,%s,%s,%s)""",(value[0],value[1],value[2],value[3],value[4]))
There is a way to make this more simple like: ?
cur.execute("""INSERT INTO ACTIVITYDESC VALUES (%s)""",(value))
Thank for your help
Turn the list into a tuple:
t = tuple(value)
cur.execute("""INSERT INTO ACTIVITYDESC VALUES %s""",(t,))