Update csv handling

This commit is contained in:
2023-05-04 23:07:06 +02:00
parent 19b2bccae3
commit 3b7a28cc23
5 changed files with 183 additions and 193 deletions

View File

@ -8,7 +8,7 @@ import os
import re
import datetime
import csv
import utils
DIR: str
@ -46,7 +46,7 @@ def sqlite_regexp(pattern: str, value: Optional[str]) -> Optional[bool]:
def import_csv(cur: sqlite3.Cursor, table_name: str) -> None:
rows = csv.parse(f'{DIR}/{table_name}.csv')
rows = utils.csv_parse(f'{DIR}/{table_name}.csv')
names = next(rows)
sql = f'INSERT INTO {table_name} ({", ".join(names)}) VALUES ({", ".join(["?"] * len(names))})'