Skip to contents

To deploy the star database, we must indicate a name for the deployment, a connection function and a disconnection function from the database. If it is the first deployment, we must also indicate the name of a local file where the star database will be stored.

Usage

deploy(db, name, connect, disconnect, file)

# S3 method for star_database
deploy(db, name, connect, disconnect = NULL, file = NULL)

Arguments

db

A star_database object.

name

A string, name of the deployment.

connect

A function that returns a DBI::DBIConnection object.

disconnect

A function that receives a DBI::DBIConnection object as a parameter and close the connection.

file

A string, name of the file to store the object.

Value

A star_database object.

Details

If the disconnection function consists only of calling DBI::dbDisconnect(con), there is no need to indicate it, it is taken by default.

As a result, it exports the tables from the star database to the connection database and from now on will keep them updated with each periodic refresh. Additionally, it will also keep a copy of the star database updated on file, which can be used when needed.

See also

star_database

Other star database deployment functions: cancel_deployment(), get_deployment_names(), load_star_database()

Examples


mrs_rdb_file <- tempfile("mrs", fileext = ".rdb")
mrs_sqlite_file <- tempfile("mrs", fileext = ".sqlite")

mrs_sqlite_connect <- function() {
  DBI::dbConnect(RSQLite::SQLite(),
                 dbname = mrs_sqlite_file)
}

mrs_db <- mrs_db |>
  deploy(
    name = "mrs",
    connect = mrs_sqlite_connect,
    file = mrs_rdb_file
  )