LodestarConn: R6 Class for abstracting database connections and maintaining...

Description Methods

Description

This class aims to provide some basic minimal functionality for interacting with a Lodestar schema in a relational database. A key ambition at outset has been the separation of user credentials and demonstration code for the preparation of examples and documentation in the vignettes.

Methods

Public methods


Method new()

Creates a new LodestarConn object. This initialisation method orchestrates other sanity checking of the defined parameters(s) to ensure that the environment is coherent and tractable

Usage
LodestarConn$new(
  backend = NA,
  keyring = .default_keyring,
  service = .default_service,
  username = NA,
  password = NA,
  port = 5432,
  silent = FALSE
)
Arguments
backend

keyring backend object used to define username and password independently of the vignette code (persistence) - NA by default

  • software will endeavour to select backend on basis of available keyring context

keyring

which of the available keyrings will hold the connection details - lodestar by default.

service

the name of the database that we'll endeavour to connect to - this will be parsed from the backend context - lodestar by default.

username

the user account to be used with the database - NA by default; in simpler installations the software will identify the username on basis of e.g. service

password

the password to connect to the database with; using the backend object this can be read from the keyring

silent

boolean defining whether logging of process should be performed (TRUE by default)

Returns

the LodestarConn R6 object


Method connection()

Get a database connection corresponding to the passed parameters

Usage
LodestarConn$connection()
Returns

a DBI connection object


Method as_list()

export the key characteristics of this object in a format for writing to YAML to allow the propagation of settings in a cluster environment where we cannot expect processes to have access to the keyring - this does mean that connection strings and passwords are written to file ... this will be addressed more securely once we're beyond the proof-of- concept.

Usage
LodestarConn$as_list()

Method list_tables()

Usage
LodestarConn$list_tables(schema = "public")

Method drop_table()

Usage
LodestarConn$drop_table(table)

Method fastx_upload()

Usage
LodestarConn$fastx_upload(dna, table = "cluster_fasta", fastx = "fasta")

Method clone()

The objects of this class are cloneable with this method.

Usage
LodestarConn$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


sagrudd/gwangmyeongseong3 documentation built on Jan. 25, 2021, 5:44 a.m.