When I run this command in python,
command=("""INSERT INTO perms(role_id,resource_id,p_create,p_read,p_update,p_delete,p_execute) VALUES
(%s,%s,%s,%s,%s,%s,%s)""")
cur.execute(command(roleArray,reasourceArrray,data[2],data[3],data[4],data[5],data[6]))
I get the following error
Traceback (most recent call last):
cur.execute(command(roleArray,reasourceArrray,data[2],data[3],data[4],data[5],data[6]))
psycopg2.ProgrammingError: can't adapt type 'numpy.int64'
bash: parse_git_branch: command not found
Additional info:
RoleArray
contains 792 records & looks like this
[102, 102, 102, 102, 102, 102, 103, 103, 105, 105, 106, 106, 106, 106, 106, 106, 106,...etc]
reasourceArrray
contains 792 records & looks like this
[45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,...etc]
data[2],data[3],data[4],data[5],data[6]
all contain 792 records & are boolean fields.
Any feedback on how to resolve the error?
UPDATE ---- Thank you everyone for the feedback! In addition to the answer I upvoted check out this solution
for i, x, y in zip(RoleArray, resourceArray, range (0,len(data[2]))):
data2Value=data[2][y]
data3Value=data[3][y]
data4Value=data[4][y]
data5Value=data[5][y]
data6Value=data[6][y]
cur.execute("INSERT INTO perms (role_id,resource_id,p_create,p_read,p_update,p_delete,p_execute) VALUES('"
+(i)+"','"+(x)+"','"+(str(data2Value))+"','"
(str(data3Value))+"','"+(str(data4Value))+"','"
(str(data5Value))+"','"+(str(data6Value))+"')")
con.commit()