Changes between Version 2 and Version 3 of IMPORT roe


Ignore:
Timestamp:
Jun 21, 2018 2:59:27 PM (7 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IMPORT roe

    v2 v3  
    1313psql -U postgres -c "Comment on table roe_v4.roe IS 'Version Mai 2014'"  eda2.2 
    1414}}} 
     15 
     16From the excel table loaded, we create a temporary table corresponding to the new dam. 
     17These might not correspond to those already in the database. 
     18lb.tempmerge is the merge between the table coming from excel and the new ROE database. 
     19 
     20{{{#!r 
     21aaouvtemp=data[,c("dep","modif","ouv_rinom","ouv_id","ouv_libelle")] 
     22sqldf( 
     23                "DROP TABLE IF EXISTS lb.aaouvtemp" 
     24                ) 
     25 
     26sqldf("create table lb.aaouvtemp as select * from aaouvtemp ") 
     27# je vais rechercher les tableaux ROE mais dans l'autre base correspondant à ces ouvrages 
     28 
     29roetemp<-sqldf( 
     30                "SELECT * from roe_v4.roe", 
     31                dbname="eda2.2", 
     32                host="localhost", 
     33        password=passwordlocal) 
     34colnames(data)[c(31:35)]<-c("Mortalite.Francis.70.cm","Mortalite.Francis.18.cm",    
     35                "Mortalite.kaplan.70.cm","Mortalite.kaplan.18.cm","Nb.turbine.entree") 
     36tempmerge<-merge(roetemp,data, by.x="cdobstecou",by.y="ouv_id") 
     37sqldf("DROP TABLE IF EXISTS lb.tempmerge") 
     38sqldf("CREATE table lb.tempmerge as select * from tempmerge") 
     39}}}