Skip to contents

Report that wraps the functionality of tessilake::read_sql and send_xlsx

Usage

# S3 method for class 'sql_report'
run(sql_report, ...)

# S3 method for class 'sql_report'
read(sql_report, query, ...)

# S3 method for class 'sql_report'
output(sql_report, query, ...)

Arguments

sql_report

sql_report object

...

Arguments passed on to tessilake::read_sql, send_email, send_file, write_xlsx

primary_keys

character vector, primary keys of the table. read_sql_table will attempt to identify the primary keys using SQL metadata.

freshness

the returned data will be at least this fresh

emails

email addresses (first will be sender)

subject

character subject of the email

body

html of message or a list containing sendmailR::mime_part objects.

name

name of the file to use in the email. Defaults to the name of the table or the inputted filename. A timestamp and extension will be appended and passed on to send_email as the name of attachments.

group

character name of column to be used for grouping/banding the data. Band color will change when column value changes.

currency

character vector of column to be used for grouping/banding the data. Band color will change when column value changes.

query

character sql query to generate the report

Methods (by generic)

  • read(sql_report): reads sql_report data

  • output(sql_report): sends sql_report data

Examples

if (FALSE) { # \dontrun{
 run(sql_report,
      query = "select * from my_table",
      subject = "Email subject",
      body = "Email body",
      emails = "me@me.com"
 )
} # }