|
|
@@ -1,24 +1,3 @@
|
|
|
-FALSE
|
|
|
-if(schema %in% db_all_schemas())
|
|
|
-TRUE
|
|
|
-if(schema %in% db_all_schemas())
|
|
|
-TRUE
|
|
|
-library(ruut)
|
|
|
-db_all_schemas <- function() {
|
|
|
-source(paste0(getwd(),"/R/db_connect.R"))
|
|
|
-conn <- db_connect()
|
|
|
-all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
|
|
|
-return (all_schemas$schema_name)
|
|
|
-}
|
|
|
-db_all_schemas()
|
|
|
-db_is_shema_exist <- function(schema = NULL) {
|
|
|
-if(schema %in% db_all_schemas())
|
|
|
-TRUE
|
|
|
-else
|
|
|
-FALSE
|
|
|
-}
|
|
|
-db_is_shema_exist(schema = "xx_matsalu")
|
|
|
-db_is_shema_exist(schema = "x_matsalu")
|
|
|
db_is_shema_exist(schema = "x_matsalu")
|
|
|
db_create_new_schema <- function(conf) {
|
|
|
conn <- db_connect()
|
|
|
@@ -510,3 +489,24 @@ conf <- ruut::get_config()
|
|
|
conf
|
|
|
styler:::style_active_file()
|
|
|
library(ruut)
|
|
|
+library(ruut)
|
|
|
+conn <- ruut::db_connect()
|
|
|
+config <- get_config()
|
|
|
+config$schema <- "public"
|
|
|
+conf = config
|
|
|
+q <- sprintf("select t.table_name
|
|
|
+from information_schema.tables t
|
|
|
+where t.table_schema = '%s'
|
|
|
+and t.table_type = 'BASE TABLE'
|
|
|
+order by t.table_name;", conf$schema)
|
|
|
+conf$schema
|
|
|
+res <- DBI::dbGetQuery(conn, q)
|
|
|
+res
|
|
|
+res <- as.array(DBI::dbGetQuery(conn, q))
|
|
|
+res <- DBI::dbGetQuery(conn, q)
|
|
|
+res[,'table_name']
|
|
|
+styler:::style_active_file()
|
|
|
+library(ruut)
|
|
|
+config
|
|
|
+config$schema <- 'maaamet'
|
|
|
+db_schema_tablenames(conf = config)
|