Copy data from python lists into postgresql tables -


i have python list cve_id, pkg_name & vuln_status. i'd import data these lists int postgresql table

what have tried:

from scanner import * import psycopg2  try:     conn = psycopg2.connect(database="test", user="postgres",password="something", host="127.0.0.1", port="5432")  except:     print "database un-successfull"     quit()  cur = conn.cursor()  cur.execute("insert vuln_data(cve_id, pkg_name, status) values (%s,%s, %s)", (cve_id, pkg_name, vuln_status))  conn.commit() conn.close() 

i error saying

psycopg2.dataerror: multidimensional arrays must have array expressions matching dimensions

                                                         ^ 

would love if point out can done, here.

thanks

try replacing cur.execute code following

cur.execute("""insert vuln_data(cve_id, pkg_name, status) values (%s,%s, %s);""", (cve_id, pkg_name, vuln_status)) 

make sure items in lists in sequence, otherwise convert tuple.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -