ImportLog: Generate log data and manage recording timings for an import

ImportLogR Documentation

Generate log data and manage recording timings for an import

Description

Generate log data and manage recording timings for an import

Generate log data and manage recording timings for an import

Details

Class to help help manage initialising log data, managing recording time for log to run and importing row to the log table.

Public fields

log_data

The current log data

Methods

Public methods


Method new()

Build the data to be written to the import log

Create import log instance for managing creating log data and importing to db.

Initialises log data and verifies that import can be logged. Set a comment for the log using set_comment

Usage
ImportLog$new(con, log_table, path, language, mode)
Arguments
con

Connection to db to add log record to

log_table

Name of the import log table

path

Path to import being run

language

The language for the import, R or sql.

language

The language for the import, R or sql

mode

The mode of the import, only relevant for an R import.

mode

The mode of the import, only relevant for an R import

import_path

Path to the import process directory.

Returns

The prepared data for the log table. This is the name of the import, the date, comment and git information including user name, user email, current branch and hash of HEAD.


Method set_comment()

Set the comment on the log data

Usage
ImportLog$set_comment(comment)
Arguments
comment

The comment to be stored with this import.


Method start_timer()

Start the import log timer

Usage
ImportLog$start_timer()

Method stop_timer()

Stop the import log timer, adding duration to the total recorded duration.

Usage
ImportLog$stop_timer()

Method write_log()

Write the log data to the database.

Usage
ImportLog$write_log()

Method verify_first_run()

Verify that this is the first time the import has been run.

Check whether an import with the same name has been run already. If so then stop with a human understandable message.

Usage
ImportLog$verify_first_run()
Returns

Throws an error if an import with the same name has already been run


vimc/dettl documentation built on Oct. 6, 2022, 2:13 p.m.