[58c332]: / archives / RadETL / man / DBMSIO.Rd

Download this file

67 lines (54 with data), 2.2 kB

 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
60
61
62
63
64
65
66
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/DBMSio.R
\docType{data}
\name{DBMSIO}
\alias{DBMSIO}
\title{DBMSIO Class}
\format{An object of class \code{R6ClassGenerator} of length 24.}
\usage{
DBMSIO
}
\arguments{
\item{server}{Enter the server address to access (See http://ohdsi.github.io/DatabaseConnector/reference/connect.html)}
\item{user}{Enter the user ID of the DBMS you want to access}
\item{pw}{Enter the password for the DBMS you want to access.}
\item{dbms}{Enter the DBMS type. ex: sql server, oracle}
}
\description{
This class is a DBMS I/O class created using the DatabaseConnector package.
}
\examples{
############################# Example Code: Data frame transfer RDBMS.. #############################
# First, connect RDBMS
# I'm not recommend to input server information in programming code (Security issues)
# So, I recommend to use environment variables in operating system
dbms <- "sql server"
user <- Sys.getenv("user")
pw <- Sys.getenv("pw")
server <- Sys.getenv("dbServer")
# Choose Database name
databaseSchema <- 'Radiology_CDM.dbo'
# Using DatabaseConnector package
io <- DBMSIO$new(server = server, user = user, pw = pw, dbms = dbms)
# df is radiology Data frame,,
# The insertDB method checks the row in the data frame and automatically inserts the table name.
# If the data frame does not fit the R-CDM, an error occurs.
# You can also inherit the insertTable from the DatabaseConnector package to accept the options for that function.
# e.q dropTableIfExists etc.
io$insertDB(dbS = databaseSchema, df = df)
################################## Example Code: Get data for RDBMS.... #############################
# Using DBMSIO class in RadETL package
# table schema names are Radiology_Image and Radiology_Occurrence
tbSchema <- "Radiology_Occurrence"
df <- io$dbGetdtS(dbS = databaseSchema, tbS = tbSchema)
# include conditions....
df <- io$dbGetdtS(dbS = databaseSchema, tbS = tbSchema, condition = "Image_total_count < 20")
df$RADIOLOGY_OCCURRENCE_ID
# if want disconnect (required)
io$finalize()
######################################## Example Code: END ##########################################
}
\author{
Neon K.I.D
}
\keyword{datasets}