deploy {rolap} | R Documentation |
Deploy a star database in a relational database
Description
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 class 'star_database'
deploy(db, name, connect, disconnect = NULL, file = NULL)
Arguments
db |
A |
name |
A string, name of the deployment. |
connect |
A function that returns a |
disconnect |
A function that receives a |
file |
A string, name of the file to store the 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.
Value
A star_database
object.
See Also
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
)