From 88f9b4ab6420dec3a04feb0b2e7ce5bcad30c294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Gru=CC=88ndger?= Date: Sat, 2 Feb 2019 10:46:04 +0100 Subject: [PATCH] No workaround SQL --- ogn/commands/bulkimport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ogn/commands/bulkimport.py b/ogn/commands/bulkimport.py index 0bc9450..a9d56e9 100644 --- a/ogn/commands/bulkimport.py +++ b/ogn/commands/bulkimport.py @@ -58,8 +58,8 @@ class LogfileDbSaver(): try: self.cur.execute('CREATE EXTENSION IF NOT EXISTS postgis;') self.cur.execute('CREATE EXTENSION IF NOT EXISTS btree_gist;') - self.cur.execute('DROP TABLE IF EXISTS "{}"; SELECT INTO {} FROM aircraft_beacons WHERE 1 = 2;'.format(self.aircraft_table)) - self.cur.execute('DROP TABLE IF EXISTS "{}"; SELECT INTO {} FROM receiver_beacons WHERE 1 = 2;'.format(self.receiver_table)) + self.cur.execute('DROP TABLE IF EXISTS "{0}"; CREATE TABLE {0} AS TABLE aircraft_beacons WITH NO DATA;'.format(self.aircraft_table)) + self.cur.execute('DROP TABLE IF EXISTS "{0}"; CREATE TABLE {0} AS TABLE receiver_beacons WITH NO DATA;'.format(self.receiver_table)) self.conn.commit() except Exception as e: raise Exception("I can't create the tables")