Skip to contents

Creates a new DuckDB database or connects to an existing one for storing Irish Weather Buoy Network data. Sets up the schema if creating new.

Usage

connect_duckdb(db_path = "inst/extdata/irish_buoys.duckdb", create_new = FALSE)

Arguments

db_path

Character, path to database file (default: "inst/extdata/irish_buoys.duckdb")

create_new

Logical, whether to create new database (default: FALSE)

Value

DBI connection object to the DuckDB database

Examples

# Connect to existing database
con <- connect_duckdb()
#>  Connected to DuckDB at inst/extdata/irish_buoys.duckdb
#>  Creating database schema...
#>  Database schema created successfully
#>  Creating database schema...

#>  Creating database schema... [10ms]
#> 

# Create new database
con <- connect_duckdb(create_new = TRUE)
#> ! Removing existing database at inst/extdata/irish_buoys.duckdb
#>  Connected to DuckDB at inst/extdata/irish_buoys.duckdb
#>  Creating database schema...
#>  Database schema created successfully
#>  Creating database schema...

#>  Creating database schema... [6ms]
#> 

# Don't forget to disconnect when done
DBI::dbDisconnect(con)