forked from iDEP-SDSU/idep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convertedDB.R
31 lines (24 loc) · 1.08 KB
/
convertedDB.R
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
# Data Read
# sqlite3 -header -csv -separator ',' 'select * from orgInfo;' > orgInfo.csv
convert <- dbConnect(sqlite,"./shinyapps/idep/data/convertIDs.db")
table <- dbGetQuery(convert, paste("SELECT name FROM sqlite_temp_master WHERE type='table'" ))
allTables <- dbListTables(convert)
GO <- dbGetQuery(convert, paste("SELECT * FROM ",allTables[1], sep="" ))
mapping <- dbGetQuery(convert, paste("SELECT * FROM ",allTables[2], sep="" ))
orgInfo <- dbGetQuery(convert, paste("SELECT * FROM ",allTables[3], sep="" ))
quotes <- dbGetQuery(convert, paste("SELECT * FROM ",allTables[4], sep="" ))
require("RPostgreSQL")
# loads the PostgreSQL driver
drv <- dbDriver("PostgreSQL")
pw <- {"example"}
install.packages("RPostgreSQL")
require("RPostgreSQL")
library(DBI)
sqlite <- dbDriver("SQLite")
# creates a connection to the postgres database
# note that "con" will be used later in each connection to the database
con <- dbConnect(PostgreSQL(),
host = "192.241.138.85", port = "5432",
user = "idep", password = "sdsu57007", dbname="idep")
dtab = dbGetQuery(con, "select * from mapping limit 50")
dtab