replace outputpath with outputfolder for consistency. update documentation.
This commit is contained in:
parent
b8425920ff
commit
de1c577b6b
|
@ -42,16 +42,16 @@ executeDdl <- function(connectionDetails,
|
|||
executeForeignKey = TRUE,
|
||||
...) {
|
||||
|
||||
outputpath <- tempdir(check = TRUE)
|
||||
outputfolder <- tempdir(check = TRUE)
|
||||
|
||||
|
||||
if(executeDdl) {
|
||||
filename <- writeDdl(targetDialect = connectionDetails$dbms,
|
||||
cdmVersion = cdmVersion,
|
||||
cdmDatabaseSchema = cdmDatabaseSchema,
|
||||
outputpath = outputpath)
|
||||
outputfolder = outputfolder)
|
||||
|
||||
sql <- readr::read_file(file.path(outputpath, filename))
|
||||
sql <- readr::read_file(file.path(outputfolder, filename))
|
||||
} else {
|
||||
sql <- ""
|
||||
}
|
||||
|
@ -60,18 +60,18 @@ executeDdl <- function(connectionDetails,
|
|||
filename <- writePrimaryKeys(targetDialect = connectionDetails$dbms,
|
||||
cdmVersion = cdmVersion,
|
||||
cdmDatabaseSchema = cdmDatabaseSchema,
|
||||
outputpath = outputpath)
|
||||
outputfolder = outputfolder)
|
||||
|
||||
sql <- paste(sql, readr::read_file(file.path(outputpath, filename)), sep = "\n")
|
||||
sql <- paste(sql, readr::read_file(file.path(outputfolder, filename)), sep = "\n")
|
||||
}
|
||||
|
||||
if(executeForeignKey) {
|
||||
filename <- writeForeignKeys(targetDialect = connectionDetails$dbms,
|
||||
cdmVersion = cdmVersion,
|
||||
cdmDatabaseSchema = cdmDatabaseSchema,
|
||||
outputpath = outputpath)
|
||||
outputfolder = outputfolder)
|
||||
|
||||
sql <- paste(sql, readr::read_file(file.path(outputpath, filename)), sep = "\n")
|
||||
sql <- paste(sql, readr::read_file(file.path(outputfolder, filename)), sep = "\n")
|
||||
}
|
||||
|
||||
con <- DatabaseConnector::connect(connectionDetails = connectionDetails)
|
||||
|
|
|
@ -5,15 +5,20 @@
|
|||
\title{Create OMOP CDM SQL files}
|
||||
\usage{
|
||||
buildRelease(
|
||||
cdmVersion = listSupportedVersions(),
|
||||
targetDialect = listSupportedDialects()
|
||||
cdmVersions = listSupportedVersions(),
|
||||
targetDialects = listSupportedDialects(),
|
||||
outputfolder = file.path(getwd(), "ddl")
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4.
|
||||
\item{cdmVersions}{The versions of the CDM you are creating, e.g. 5.3, 5.4.
|
||||
Defaults to all supported CDM versions.}
|
||||
|
||||
\item{targetDialect}{The target dialect}
|
||||
\item{targetDialects}{A character vector of target dialects.
|
||||
Defaults to all supported dialects.}
|
||||
|
||||
\item{outputfolder}{The base folder where the SQL files will be written.
|
||||
Subfolders will be created for each cdmVersion and targetDialect.}
|
||||
}
|
||||
\description{
|
||||
Writes DDL, ForeignKey, PrimaryKey and index SQL files for given cdmVersion
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
buildReleaseZip(
|
||||
cdmVersion,
|
||||
targetDialect = listSupportedDialects(),
|
||||
outputfolder = "output"
|
||||
outputfolder = file.path(getwd(), "ddl")
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
|
|
|
@ -10,28 +10,28 @@
|
|||
writeDdl(
|
||||
targetDialect,
|
||||
cdmVersion,
|
||||
outputpath,
|
||||
outputfolder,
|
||||
cdmDatabaseSchema = "@cdmDatabaseSchema"
|
||||
)
|
||||
|
||||
writePrimaryKeys(
|
||||
targetDialect,
|
||||
cdmVersion,
|
||||
outputpath,
|
||||
outputfolder,
|
||||
cdmDatabaseSchema = "@cdmDatabaseSchema"
|
||||
)
|
||||
|
||||
writeForeignKeys(
|
||||
targetDialect,
|
||||
cdmVersion,
|
||||
outputpath,
|
||||
outputfolder,
|
||||
cdmDatabaseSchema = "@cdmDatabaseSchema"
|
||||
)
|
||||
|
||||
writeIndex(
|
||||
targetDialect,
|
||||
cdmVersion,
|
||||
outputpath,
|
||||
outputfolder,
|
||||
cdmDatabaseSchema = "@cdmDatabaseSchema"
|
||||
)
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ writeIndex(
|
|||
|
||||
\item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4}
|
||||
|
||||
\item{outputpath}{The directory or folder where the SQL file should be saved.}
|
||||
\item{outputfolder}{The directory or folder where the SQL file should be saved.}
|
||||
|
||||
\item{cdmDatabaseSchema}{The schema of the CDM instance where the DDL will be run. For example, this would be "ohdsi.dbo" when testing on sql server.
|
||||
Defaults to "@cdmDatabaseSchema"}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
test_that("writeDdl works", {
|
||||
|
||||
outputpath <- tempdir(TRUE)
|
||||
filename <- writeDdl(targetDialect = "postgresql", cdmVersion = "5.4", outputpath = outputpath)
|
||||
outputfolder <- tempdir(TRUE)
|
||||
filename <- writeDdl(targetDialect = "postgresql", cdmVersion = "5.4", outputfolder = outputfolder)
|
||||
|
||||
expect_true(file.exists(file.path(outputpath, filename)))
|
||||
sql <- readr::read_file(file.path(outputpath, filename))
|
||||
expect_true(file.exists(file.path(outputfolder, filename)))
|
||||
sql <- readr::read_file(file.path(outputfolder, filename))
|
||||
|
||||
expect_type(sql, "character")
|
||||
expect_gt(nchar(sql), 10)
|
||||
|
@ -13,11 +13,11 @@ test_that("writeDdl works", {
|
|||
|
||||
test_that("writePrimaryKeys works", {
|
||||
|
||||
outputpath <- tempdir(TRUE)
|
||||
filename <- writePrimaryKeys(targetDialect = "postgresql", cdmVersion = "5.4", outputpath = outputpath)
|
||||
outputfolder <- tempdir(TRUE)
|
||||
filename <- writePrimaryKeys(targetDialect = "postgresql", cdmVersion = "5.4", outputfolder = outputfolder)
|
||||
|
||||
expect_true(file.exists(file.path(outputpath, filename)))
|
||||
sql <- readr::read_file(file.path(outputpath, filename))
|
||||
expect_true(file.exists(file.path(outputfolder, filename)))
|
||||
sql <- readr::read_file(file.path(outputfolder, filename))
|
||||
|
||||
expect_type(sql, "character")
|
||||
expect_gt(nchar(sql), 10)
|
||||
|
@ -26,11 +26,11 @@ test_that("writePrimaryKeys works", {
|
|||
|
||||
test_that("writeForeignKeys works", {
|
||||
|
||||
outputpath <- tempdir(TRUE)
|
||||
filename <- writeForeignKeys(targetDialect = "postgresql", cdmVersion = "5.4", outputpath = outputpath)
|
||||
outputfolder <- tempdir(TRUE)
|
||||
filename <- writeForeignKeys(targetDialect = "postgresql", cdmVersion = "5.4", outputfolder = outputfolder)
|
||||
|
||||
expect_true(file.exists(file.path(outputpath, filename)))
|
||||
sql <- readr::read_file(file.path(outputpath, filename))
|
||||
expect_true(file.exists(file.path(outputfolder, filename)))
|
||||
sql <- readr::read_file(file.path(outputfolder, filename))
|
||||
|
||||
expect_type(sql, "character")
|
||||
expect_gt(nchar(sql), 10)
|
||||
|
@ -39,11 +39,11 @@ test_that("writeForeignKeys works", {
|
|||
|
||||
test_that("writeIndex works", {
|
||||
|
||||
outputpath <- tempdir(TRUE)
|
||||
filename <- writeIndex(targetDialect = "postgresql", cdmVersion = "5.4", outputpath = outputpath)
|
||||
outputfolder <- tempdir(TRUE)
|
||||
filename <- writeIndex(targetDialect = "postgresql", cdmVersion = "5.4", outputfolder = outputfolder)
|
||||
|
||||
expect_true(file.exists(file.path(outputpath, filename)))
|
||||
sql <- readr::read_file(file.path(outputpath, filename))
|
||||
expect_true(file.exists(file.path(outputfolder, filename)))
|
||||
sql <- readr::read_file(file.path(outputfolder, filename))
|
||||
|
||||
expect_type(sql, "character")
|
||||
expect_gt(nchar(sql), 10)
|
||||
|
|
Loading…
Reference in New Issue