mfdb: MareFrame DB class

Description Usage Arguments Examples

Description

Create a class representing a connection to a MareFrame DB

Usage

1
2
3
4
5
6
    mfdb(case_study_name,
         db_params = list(),
         destroy_schema = FALSE,
         save_temp_tables = FALSE)

    mfdb_disconnect(mdb)

Arguments

case_study_name

The name of the case study you are working with, should be a valid name from mfdb::case_study.

db_params

Extra parameters to supply to a DBI connection object. By default it will search for a PostgreSQL "mf" database locally.

destroy_schema

Optional boolean. If true, all mfdb tables will be dropped, allowing you to recreate your schema. Returns NULL, you need to call mfdb to connect and rebuild schema.

save_temp_tables

Optional boolean. If true, any temporary tables will be made permanent for later inspection.

mdb

Database connection created by mfdb().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
    # Connect to local DB, as the Iceland case study
    mdb <- mfdb('Iceland')

    # Connect to "mf2014" on remote DB server
    mdb <- mfdb('Iceland', db_params = list(host = "db.mareframe-fp7.org", dbname = "mf2014")

    # Stop it and tidy up
    mfdb_disconnect(mdb)

    # Destroy everything, since schema was out of date.
    mfdb('', destroy_schema = TRUE)

## End(Not run)

sCervino/mfdb documentation built on May 18, 2019, 1:31 p.m.