From f14449d4f0b19cbcd6def7942459b7819e4a0600 Mon Sep 17 00:00:00 2001 From: Michael Behrisch Date: Thu, 30 Jun 2022 09:59:39 +0200 Subject: [PATCH] fixing fallback #39 #35 --- s2t_miv.py | 3 +-- tsc_main.py | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/s2t_miv.py b/s2t_miv.py index 0515011..c0fbbf7 100755 --- a/s2t_miv.py +++ b/s2t_miv.py @@ -234,8 +234,6 @@ def upload_all_pairs(conn, tables, start, end, vType, real_routes, rep_routes, n def create_all_pairs(conn, key, params): cursor = conn.cursor() schema_table, table, exists = db_manipulator.check_schema_table(conn, 'temp', '%s_%s' % (params[SP.od_output], key)) - if exists: - cursor.execute("DROP TABLE " + schema_table) createQuery = """ CREATE TABLE %s ( @@ -250,6 +248,7 @@ def create_all_pairs(conn, key, params): ) """ try: + cursor.execute("DROP TABLE IF EXISTS " + schema_table) cursor.execute(createQuery % (schema_table, table)) except Exception: conn.rollback() diff --git a/tsc_main.py b/tsc_main.py index d909fd7..9773a70 100755 --- a/tsc_main.py +++ b/tsc_main.py @@ -449,11 +449,7 @@ def simulation_request(options, request): _, _, exists = db_manipulator.check_schema_table(conn, 'temp', '%s_%s' % (params[SP.trip_output], sim_key)) if not exists or options.overwrite: write_status('>> starting trip result database upload', sim_key, params, conn) - try: - s2t_miv.upload_trip_results(conn, sim_key, params, final_routes) - except ProgrammingError as message: - conn.rollback() - write_status(message, sim_key, params, conn, constants.MSG_TYPE.error) + s2t_miv.upload_trip_results(conn, sim_key, params, final_routes) write_status('<< finished trip result database upload', sim_key, params, conn) print() # run all pair calculations