fix: correctly adapted script for new primary key

This commit is contained in:
Leonard Excoffier
2024-08-30 08:16:05 -04:00
parent 184f82a688
commit 6fcbc73a4f

View File

@@ -33,9 +33,9 @@ def insert_fact(cursor, taxonomy, fact_id, label, description, unit):
def insert_data(cursor, cik, fact_id, start, end, val, accn, fy, fp, form, filed, frame): def insert_data(cursor, cik, fact_id, start, end, val, accn, fy, fp, form, filed, frame):
cursor.execute( cursor.execute(
"""INSERT IGNORE INTO data (cik, fact_id, start, end, val, accn, fy, fp, form, filed, frame) """INSERT IGNORE INTO data (cik, fact_id, end, start, val, accn, fy, fp, form, filed, frame)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
(cik, fact_id, start, end, val, accn, fy, fp, form, filed, frame) (cik, fact_id, end, start, val, accn, fy, fp, form, filed, frame)
) )
def cik_exists(cursor, cik): def cik_exists(cursor, cik):
@@ -51,7 +51,7 @@ def parse_json_and_insert_data(file_path):
# Start a new connection for each file # Start a new connection for each file
conn = connect_to_db() conn = connect_to_db()
if conn is None: if conn is None:
return False return False
try: try:
cursor = conn.cursor() cursor = conn.cursor()