diff --git a/structure_SIMO_rslDB_FBE.R b/structure_SIMO_rslDB_FBE.R index 4fa42b35ec5d6db1180310885b5a72bf0b9eb0ac..37ff8f1364ec1bd0c4732d3faf3b41846d2bf18b 100644 --- a/structure_SIMO_rslDB_FBE.R +++ b/structure_SIMO_rslDB_FBE.R @@ -21,6 +21,9 @@ library(RSQLite) # Queries: +# ------------------ +print("queries loaded") + create_table_max_v <- 'CREATE TABLE max_v AS SELECT comp_unit.id AS id, MAX(comp_unit.V) AS max_v FROM comp_unit GROUP BY comp_unit.id' @@ -124,36 +127,12 @@ create_table_UNIT <- 'Create Table UNIT AS SELECT u.*, -##### For each "db_names", defined in main.R ... -for (name in db_names) { - print(name) - db <- dbConnect(dbDriver("SQLite"), - dbname = paste(inputFolder, - paste0(name, ".db"), sep = "/")) - print(db) - dbDisconnect(db) -} - +##### Create tables "OPERS2", "OPERS3", "max_v", "UNIT" within each database +# ----------------------------------------------------- for (name in db_names){ - #print(name) - - #name = "simulated_without_MV_Korsnas_Wind_NO_1-15" - # Connect to the database - #con <- dbConnect(dbDriver("SQLite"), - # dbname = paste0(path,"input_data/simulated_", sim_variant,"_" ,name , "_rsu.db")) - - #db <- dbConnect(dbDriver("SQLite"), - # dbname = paste0(path, "input_data/simulated_without_MV_Korsnas_Wind_NO_1-15.db")) - - #db <- dbConnect(dbDriver("SQLite"), - # dbname = paste(inputFolder, paste0(name, ".db"), sep = "/")) - - - - - + # Connect to database db <- dbConnect(dbDriver("SQLite"), dbname = paste(inputFolder, paste0(name, ".db"), sep = "/")) @@ -183,7 +162,7 @@ for (name in db_names){ rm(query_to_run, tab_to_delete, db) } -rm(create_table_max_v, create_table_OPERS2, create_table_OPERS3, create_table_UNIT) +#rm(create_table_max_v, create_table_OPERS2, create_table_OPERS3, create_table_UNIT)