Skip to content

Commit

Permalink
Building indices on test server
Browse files Browse the repository at this point in the history
  • Loading branch information
schuemie committed Oct 12, 2023
1 parent 339ddb7 commit 20c66bd
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions extras/UploadDataToTestServer.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ disconnect(eunomiaConn)
# Copy data from one test server to another ------------------------------------

library(DatabaseConnector)
options(andromedaTempFolder = "d:/andromedaTemp")
options(andromedaTempFolder = "e:/andromedaTemp")

fromConnection <- connect(
dbms = "sql server",
Expand All @@ -62,6 +62,15 @@ toConnection <- connect(
)
toDatabaseSchema <- Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA")

# toConnection <- connect(
# dbms = "postgresql",
# user = Sys.getenv("LOCAL_POSTGRES_USER"),
# password = Sys.getenv("LOCAL_POSTGRES_PASSWORD"),
# server = Sys.getenv("LOCAL_POSTGRES_SERVER")
# )
# toDatabaseSchema <- Sys.getenv("LOCAL_POSTGRES_CDM_SCHEMA")


tableNames <- getTableNames(fromConnection, fromDatabaseSchema)
for (i in seq_along(tableNames)) {
# for (i in 31:length(tableNames)) {
Expand Down Expand Up @@ -108,9 +117,18 @@ for (i in seq_along(toTableNames)) {
column = colnames(row)[j])
}
}

}

# Create indices:
sql <- readLines("https://raw.githubusercontent.com/OHDSI/CommonDataModel/v5.4.0/inst/ddl/5.4/postgresql/OMOPCDM_postgresql_5.4_indices.sql")
sql <- sql[!grepl("note_nlp", sql)]

renderTranslateExecuteSql(
connection = toConnection,
sql = paste(sql, collapse = "\n"),
cdmDatabaseSchema = toDatabaseSchema
)

disconnect(fromConnection)
disconnect(toConnection)

Expand Down

0 comments on commit 20c66bd

Please sign in to comment.