Skip to content
Snippets Groups Projects
Commit 94d54db8 authored by Hernandez-Courbevoie Yohan's avatar Hernandez-Courbevoie Yohan
Browse files

Fix the table and json build

parent b2bb93a9
Branches
No related tags found
No related merge requests found
......@@ -63,7 +63,7 @@ def insert_data(table, raw):
try:
with psycopg2.connect(**config) as conn:
with conn.cursor() as cur:
cur.execute(sql, (table, taxoId, commonName, scientificName, parentId, rank))
cur.execute(sql, (taxoId, commonName, scientificName, parentId, rank))
conn.commit()
except (Exception, psycopg2.DatabaseError) as error:
print(error)
......
......@@ -56,7 +56,7 @@ def add_childs(cur, table, json, id):
# print(sql)
childrens = []
try:
cur.execute(sql, (table))
cur.execute(sql)
rows = cur.fetchall()
# idx = 0
# print("rowcount",cur.rowcount)
......@@ -68,7 +68,7 @@ def add_childs(cur, table, json, id):
json_object = {"id" : new_id, "text" : text, "children" : []}
state = { "opened" : "false", "disabled" : "true" }
json_object["state"] = state
add_childs(cur, json_object, new_id)
add_childs(cur, table, json_object, new_id)
childrens.append(json_object)
json["children"] = childrens
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment