Skip to content

Commit 9de71b7

Browse files
author
Herfort
committed
delete raw tables #90
1 parent 8c1b5cd commit 9de71b7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mapswipe_workers/basic/BaseFunctions.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ def update_users_postgres(firebase, postgres, users_txt_filename='raw_users.txt'
507507
508508
ON CONFLICT ON CONSTRAINT "users_pkey"
509509
DO UPDATE SET contributions = excluded.contributions
510-
,distance = excluded.distance
511-
;
510+
,distance = excluded.distance;
511+
DROP TABLE IF EXISTS raw_users CASCADE;
512512
''' # conflict action https://www.postgresql.org/docs/current/sql-insert.html
513513
p_con.query(sql_insert, None)
514514
logging.warning('ALL - update_users - inserted results into users table and updated contributions and/or distance')
@@ -724,7 +724,8 @@ def save_results_postgres(postgres, results_filename):
724724
FROM
725725
raw_results
726726
ON CONFLICT ON CONSTRAINT "results_pkey"
727-
DO UPDATE SET duplicates = results.duplicates + 1
727+
DO UPDATE SET duplicates = results.duplicates + 1;
728+
DROP TABLE IF EXISTS raw_results CASCADE;
728729
'''
729730

730731
p_con.query(sql_insert, None)

mapswipe_workers/basic/BaseImport.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ def execute_import_queries(self, postgres, project_id, project_dict, groups_dict
239239
SELECT
240240
*
241241
FROM
242-
raw_groups
242+
raw_groups;
243+
DROP TABLE IF EXISTS raw_groups CASCADE;
243244
'''
244245

245246
query_recreate_raw_tasks = '''
@@ -258,7 +259,8 @@ def execute_import_queries(self, postgres, project_id, project_dict, groups_dict
258259
SELECT
259260
*
260261
FROM
261-
raw_tasks
262+
raw_tasks;
263+
DROP TABLE IF EXISTS raw_tasks CASCADE;
262264
'''
263265

264266
groups_txt_filename = self.create_groups_txt_file(project_id, groups_dict)

0 commit comments

Comments
 (0)