Day 2, full DB import/update/delete from dir with XML or HTTP
This commit is contained in:
7
aore/templates/postgre/bulk_update.sql
Normal file
7
aore/templates/postgre/bulk_update.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
DROP TABLE IF EXISTS "%tablename%_TEMP";
|
||||
CREATE TEMP TABLE "%tablename%_TEMP" ON COMMIT DROP AS SELECT *
|
||||
FROM "%tablename%" WITH NO DATA;
|
||||
COPY "%tablename%_TEMP" (%fieldslist%) FROM '%csvname%' DELIMITER '%tab%' NULL 'NULL';
|
||||
INSERT INTO "%tablename%" (%fieldslist%) SELECT %fieldslist%
|
||||
FROM
|
||||
"%tablename%_TEMP" ON CONFLICT (%uniquekey%) DO UPDATE SET %updaterule%;
|
||||
Reference in New Issue
Block a user