Skip to content

Commit

Permalink
feat: import sqlite data
Browse files Browse the repository at this point in the history
close #17
  • Loading branch information
jhk0530 committed Nov 13, 2023
1 parent feef1de commit d7ff843
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: door
Title: Shiny module for statgarten
Version: 0.4.3
Version: 0.4.4
Authors@R:
person("Jinhwan", "Kim", , "[email protected]", role = c("cre", "aut"))
Description: Main application for data analysis using statgarten packages.
Expand All @@ -13,6 +13,7 @@ Imports:
config (>= 0.3.1),
data.table (>= 1.14.2),
datamods (>= 1.3.3),
DBI (>= 1.1.3),
dplyr (>= 1.0.9),
DT (>= 0.24),
esquisse (>= 1.1.1),
Expand All @@ -32,6 +33,7 @@ Imports:
readxl (>= 1.4.1),
remotes,
rmarkdown (>= 2.16),
RSQLite (>= 2.3.2),
rticles (>= 0.25),
scissor,
shiny (>= 1.7.1),
Expand Down
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ import(shiny)
import(shiny.i18n)
import(shinyWidgets)
import(tidyr)
importFrom(DBI,dbConnect)
importFrom(DBI,dbDisconnect)
importFrom(DBI,dbGetQuery)
importFrom(DBI,dbListTables)
importFrom(DBI,dbWriteTable)
importFrom(DT,DTOutput)
importFrom(DT,datatable)
importFrom(DT,formatStyle)
importFrom(GGally,ggcorr)
importFrom(RSQLite,SQLite)
importFrom(board,mod_distributionModule_server)
importFrom(board,mod_distributionModule_ui)
importFrom(colorpen,mod_mapVisModule_server)
Expand Down
11 changes: 10 additions & 1 deletion R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#'
#' @import datamods
#' @import rmarkdown
#' @importFrom DBI dbConnect dbWriteTable dbListTables dbGetQuery dbDisconnect
#' @importFrom RSQLite SQLite

#' @noRd
app_server <- function(input, output, session) {
Expand Down Expand Up @@ -506,7 +508,7 @@ app_server <- function(input, output, session) {
".csv", ".dta", ".fst", ".rda", ".rds",
".rdata", ".sas7bcat", ".sas7bdat",
".sav", ".tsv", ".txt", ".xls", ".xlsx",
".xml", ".json"
".xml", ".json", ".sqlite"
)
)
})
Expand Down Expand Up @@ -604,6 +606,13 @@ app_server <- function(input, output, session) {
},
json = function(file) {
jsonlite::fromJSON(file)
},
sqlite = function(file){
con <- dbConnect(SQLite(), file)
tableName <- dbListTables(con)
res <- dbGetQuery(con, paste0("SELECT * FROM ", tableName))
dbDisconnect(con)
return(res)
}
)
)
Expand Down
Binary file modified examples/iris.rda
Binary file not shown.
Binary file added examples/iris.sqlite
Binary file not shown.
2 changes: 1 addition & 1 deletion man/init.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7ff843

Please sign in to comment.