Connect to the rfishbase database
default_db(dbdir = db_dir(), driver = Sys.getenv("DB_DRIVER", "RSQLite"))
Path to the database.
Default driver, one of "duckdb", "MonetDBLite", "RSQLite". `rfishbase` will select the first one of those it finds available if a driver is not set. This fallback can be overwritten either by explicit argument or by setting the environmental variable `rfishbase_DRIVER`.
Returns a `src_dbi` connection to the default duckdb database
This function provides a default database connection for `rfishbase`. Note that you can use `rfishbase` with any DBI-compatible database connection by passing the connection object directly to `rfishbase` functions using the `db` argument. `default_db()` exists only to provide reasonable automatic defaults based on what is available on your system.
`duckdb` or `MonetDBLite` will give the best performance, and regular users `rfishbase` will work with the built-in `RSQlite`, and with other database connections such as Postgres or MariaDB, but queries (filtering joins) will be much slower on these non-columnar databases.
For performance reasons, this function will also cache and restore the existing database connection, making repeated calls to `default_db()` much faster and more failsafe than repeated calls to [DBI::dbConnect]