import sys

class WorkerCarRecord:
    def __init__(self, worker, car):
        self.worker = worker
        self.car = car

f = open(sys.argv[1], mode="r")

dump_file = open(sys.argv[2], mode="w")

rows = f.read().split("\n")

dump_file.write("""
CREATE TABLE evi.worker_car
(
    worker_id text COLLATE pg_catalog."default",
    car_id text COLLATE pg_catalog."default"
);
\n""")

for row in rows:
    if len(row) == 0:
        continue

    cols = row.split(",")
    record = WorkerCarRecord(cols[0], cols[1])

    dump_file.write(f"""INSERT INTO evi.worker_car (worker_id, car_id)
                    VALUES ('{record.worker}', '{record.car}');\n""")
