#!/bin/bash # script for transfering table parameters (old DB) to table variable (new DB) # # new design of variable: # Table "public.variable" # Column | Type | Collation | Nullable | Default #----------------------+------------------------+-----------+----------+-------------------------------------- #id | integer | | not null | nextval('variable_id_seq'::regclass) #variable_name | character varying(32) | | not null | #variable_longname | character varying(128) | | not null | #variable_displayname | character varying(128) | | not null | #variable_standardname | character varying(128) | | not null | #variable_units | character varying(64) | | not null | #variable_formula | character varying(128) | | not null | # # new (not available in old DB): # id # attention!!! variable_formula is defined as NOT NULL (but some variables do not have a formula!) # attention!!! The above remark also holds for variable_standardname! # # author: s.schroeder@fz-juelich.de # date: 2020-06-05 psql -h zam10131.zam.kfa-juelich.de -U s.schroeder surface_observations_toar -W -c "\COPY (select * from parameters) TO 'parameters_20200103_export.txt'" echo "null values of variable_formula have been manually exchanged!" echo "null values of variable_standardname have been manually exchanged!" psql -h localhost -U django toar2 -W -c "\COPY variable (variable_name, variable_longname, variable_displayname, variable_standardname, variable_units, variable_formula) FROM 'parameters_20200103_export.txt'"