Skip to contents

Creates a local mock SQL database from package test data for demonstration purposes. No internet connection required.

Usage

demo_db_create(db_type = "nucleotide", n = 100)

Arguments

db_type

character, database type

n

integer, number of mock sequences

Examples

library(restez)
# set the restez path to a temporary dir
restez_path_set(filepath = tempdir())
#> ... Creating '/tmp/RtmpWQaZTT/restez'
#> ... Creating '/tmp/RtmpWQaZTT/restez/downloads'
# create demo database
demo_db_create(n = 5)
#> duckdb keeps downloaded extensions and secrets in a temporary directory:
#>  /tmp/RtmpWQaZTT/duckdb
#> This is removed when the R session ends.
#>  Extensions are re-downloaded each session.
#>  Secrets are lost.
#>  Run duckdb(shared_home = TRUE) (or create ~/.duckdb) to keep them (suitable for most users).
#>  Run duckdb(shared_home = FALSE) to accept the temporary directory (and silence this message).
#>  See ?duckdb_storage for details and alternatives.
# in the demo, IDs are 'demo_1', 'demo_2' ...
(gb_sequence_get(id = 'demo_1'))
#> duckdb keeps downloaded extensions and secrets in a temporary directory:
#>  /tmp/RtmpWQaZTT/duckdb
#> This is removed when the R session ends.
#>  Extensions are re-downloaded each session.
#>  Secrets are lost.
#>  Run duckdb(shared_home = TRUE) (or create ~/.duckdb) to keep them (suitable for most users).
#>  Run duckdb(shared_home = FALSE) to accept the temporary directory (and silence this message).
#>  See ?duckdb_storage for details and alternatives.
#>       demo_1 
#> "ATTTAACTAT" 

# Delete a demo database after an example
db_delete(everything = TRUE)