Changes between Initial Version and Version 1 of saving and loading the database


Ignore:
Timestamp:
Jun 1, 2018 7:56:34 PM (7 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • saving and loading the database

    v1 v1  
     1= Saving and loading EDA2.0 = 
     2 
     3 
     4{{{ 
     5cedric 
     6pg_dump -U postgres -h 192.168.1.104 --schema public --schema wrbd --file "eda2_public_wrbd.sql" --verbose eda2 
     7pg_dump -U postgres -h 192.168.1.104 --schema ccm21 --file "eda2_ccm21.sql" --verbose eda2  
     8pg_dump -U postgres -h 192.168.1.104 --schema europe --file "eda2_europe.sql" --verbose eda2  
     9pg_dump -U postgres -h 192.168.1.104 --table ccm21.riversegments --file "eda2_ccm21_riversegments.sql" --verbose eda2 
     10pg_dump -U postgres -h 192.168.1.104 --table ccm21.model_mod --table ccm21.resultmodel --table ccm21.temp_western --file "eda2_ccm21_othernew.sql" --verbose eda2 
     11pg_dump -U postgres -h 192.168.1.104 --schema public --table ccm21.catchments --file "eda2_ccm21_catchments.sql" --verbose eda2 # corrupted ? 
     12elvira 
     13cd c:\data 
     14 
     15psql -U postgres -h localhost --file "eda2_public_wrbd.sql" eda2 
     16restoring an older version of ccm21 
     17psql -U postgres -h localhost --file "eda2_ccm21.sql" eda2  (this is from a previous save to restore catchment) 
     18 
     19Now we have a problem with ccm21, we will delete the tables that we do not want to keep from the older version 
     20 
     21psql -U postgres -h localhost -c "drop table ccm21.riversegments cascade" eda2 
     22psql -U postgres -h localhost --file "eda2_ccm21_othernew.sql" eda2 (tables model_mod, temp_western, and resultmodel) 
     23psql -U postgres -h localhost --file "eda2_ccm21_riversegments.sql" eda2 
     24psql -U postgres -h localhost --file "eda2_ccm21_europe.sql" eda2 
     25verification that the version is all right 
     26select count(*) from ccm21.riversegments;--690349 
     27select count(*) from ccm21.catchments; --745668 
     28select count(*) from ccm21.riversegments where cum_len_sea>0; --234567 
     29}}} 
     30 
     31 
     32 
     33== Saving and loading dbeel == 
     34restoring the dbeel 
     35psql -U postgres -h localhost --file "backup_dbeel_12082011.sql" eda2 
     36 
     37== saving shp files from ccm21 == 
     38 
     39{{{ 
     40use psql2shp 
     41pgsql2shp -f "C:\data\riversegments" -p 5432 -u postgres -g the_geom -r -k eda2 "select * from ccm21.riversegments where wso_id in (select wso_id from europe.wso where area='Ireland');" 
     42}}} 
     43 
     44== Inserting wso1 values == 
     45{{{ 
     46#!sql 
     47/* some checking 
     48SELECT * FROM ccm21.riversegments where wso1_id in (select wso1_id from europe.wso1 where area='Ireland')  ORDER BY gid ; 
     49select distinct on (area) area from europe.wso1  
     50select * from europe.wso where area='Ireland'; 
     51select r.wso_id,r.wso1_id, area from europe.wso e join ccm21.riversegments r on e.wso_id=r.wso_id where area='Ireland' limit 50; 
     52select * from europe.wso1 limit 10; 
     53*/ 
     54-- the right request 
     55insert into europe.wso1 (wso_id,wso1_id, area)  
     56        select r.wso_id,r.wso1_id, area from europe.wso e join ccm21.riversegments r on e.wso_id=r.wso_id where area='Ireland';--8644 
     57}}} 
     58[[Image(source:eda/data/Docs/trac/Ireland/qgis.jpg,600px)]] 
     59{{{ 
     60wso_id in (select wso_id from europe.wso where area= 'Ireland') 
     61}}} 
     62 
     63 
     64== TODO list == 
     65 1. dams 
     66  11. Import dam data into postgres 
     67  12. Build the table joining dam data 
     68  13. Run R program to calculate the cumulated number of dams from the sea. 
     69 2. run the program to calculate the clc numbers 
     70  21. run sql script 
     71 ["Ireland clc"][[BR]] 
     72  22. run R program 
     73 3. run the program to calculate the distance to the source 
     74 4. import electrofishing data into the dbeel 
     75 
     76["Ireland_dams"] [[BR]] 
     77["electrofishing data"][[BR]] 
     78["Ireland dbeel"][[BR]] 
     79["Ireland geology"][[BR]]