forked from OHDSI/SqlRender
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathloadRenderTranslateSql.Rd
59 lines (53 loc) · 1.96 KB
/
loadRenderTranslateSql.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/HelperFunctions.R
\name{loadRenderTranslateSql}
\alias{loadRenderTranslateSql}
\title{Load, render, and translate a SQL file in a package}
\usage{
loadRenderTranslateSql(
sqlFilename,
packageName,
dbms = "sql server",
...,
tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
oracleTempSchema = NULL,
warnOnMissingParameters = TRUE
)
}
\arguments{
\item{sqlFilename}{The source SQL file}
\item{packageName}{The name of the package that contains the SQL file}
\item{dbms}{The target dialect. Currently 'sql server', 'oracle', 'postgres',
and 'redshift' are supported}
\item{...}{Parameter values used for \code{render}}
\item{tempEmulationSchema}{Some database platforms like Oracle and Impala do not truly support
temp tables. To emulate temp tables, provide a schema with write
privileges where temp tables can be created.}
\item{oracleTempSchema}{DEPRECATED: use \code{tempEmulationSchema} instead.}
\item{warnOnMissingParameters}{Should a warning be raised when parameters provided to this
function do not appear in the parameterized SQL that is being
rendered? By default, this is TRUE.}
}
\value{
Returns a string containing the rendered SQL.
}
\description{
\code{loadRenderTranslateSql} Loads a SQL file contained in a package, renders it and translates it
to the specified dialect
}
\details{
This function looks for a SQL file with the specified name in the inst/sql/<dbms> folder of the
specified package. If it doesn't find it in that folder, it will try and load the file from the
inst/sql or inst/sql/sql_server folder and use the \code{translate} function to translate it to the
requested dialect. It will subsequently call the \code{render} function with any of the additional
specified parameters.
}
\examples{
\dontrun{
renderedSql <- loadRenderTranslateSql("CohortMethod.sql",
packageName = "CohortMethod",
dbms = connectionDetails$dbms,
CDM_schema = "cdmSchema"
)
}
}