Skip to contents

Functions for registries that wants to implement exporting of registry databases, e.g. for local development purposes. Also includes relevant helper functions

Usage

exportUCInput(id)

exportUCServer(
  id,
  dbName,
  teamName = NULL,
  eligible = shiny::reactiveVal(TRUE)
)

exportUCApp(dbName = "rapbase")

selectListPubkey(pubkey)

exportDb(dbName, dropTabs = NULL, tableNames = "", compress = FALSE, session)

queryToFile(
  dbName,
  tableName = "",
  query,
  format = "RDS",
  compress = FALSE,
  session
)

Arguments

id

Character string module ID

dbName

Character string database name. If this is `data`, then the database name is taken from the environment variable `MYSQL_DB_DATA`.

teamName

Character string defining the github team name containing members allowed to export the database. Default value is dbName.

eligible

Logical defining if the module should be allowed to work at full capacity. This might be useful when access to module products should be restricted. Default is TRUE, i.e. no restrictions.

pubkey

Character vector with public keys

dropTabs

Character vector with names of tables to be excluded from export.

tableNames

Character vector with names of tables to export. Only used when exporting the whole database, not a single table.

compress

Logical if export data is to be compressed (using gzip). FALSE by default.

session

Shiny session object

tableName

Character string with name of table to export. Only used when exporting a single table, not the whole database.

query

Character string with SQL query to fetch data to export. Only used when exporting a single table, not the whole database.

format

Character string with format to export data in. Only used when exporting a single table, not the whole database. Possible values are

Value

Shiny objects, mostly. Helper functions may return other stuff too.

Examples

## client user interface function
ui <- shiny::fluidPage(
  shiny::sidebarLayout(
    shiny::sidebarPanel(
      exportUCInput("test"),
    ),
    shiny::mainPanel(
      NULL
    )
  )
)

## server function
server <- function(input, output, session) {
  exportUCServer("test", dbName = "rapbase")
}

## run the shiny app in an interactive environment
if (interactive()) {
  shiny::shinyApp(ui, server)
}