Module - mitto.subscriptions_types

SubscriptionsConfig

Configuration for a subscription job.

type

object

properties

  • subscriptions

Defines input sources and report defaults.

Subscriptions

allOf

SubscriptionsSection

  • tabcmd_export

Configuration for job_tableau_export that will be run for each subscription.

FIXME: add link to documentation for Tableau Export.

Tabcmd_Export

allOf

TabcmdExportSection

definitions

  • InputSection

InputSection

Defines source/destination for data.

type

object

properties

  • dbo

Dbo

The dbo specifying the database to use.

Example: "postgresql://localhost/mitto"

type

string

  • schema_name

Schema_Name

The name of the schema.

Example: "public"

type

string

  • table_name

Table_Name

The name of the table.

Example: "subscriptions_status"

type

string

  • ReportSpecificationSection

ReportSpecificationSection

Basic defaults controlling how reports are emailed. These are ultimately passed to job_tableau_export. Refer to its docuemtation for general usage.

This job implements limited templating for some parameters. See below.

type

object

properties

  • mail_subject

Mail_Subject

Contents of email subject line. If {view} is present in the string, it is replaced with the name of the Tableau view used to create the report.

Example: "Your Tableau report: {view}"

type

string

  • mail_from

Mail_From

Email address that will appear in the From: line of the email containing the report.

Example: "steve@zuar.com"

type

string

  • mail_bcc

Mail_Bcc

Email address that will receive blind copies of the email.

Example: "steve@zuar.com"

type

string

  • mail_body

Mail_Body

Body of the email containing the report. HTML content is allowed.

Examples:

"Your Tableau report is attached."

"<h2>Your Tableau report is attached.</h2></br></br>"

type

string

  • report_name

Report_Name

Filename to use (minus the extension) when attaching the report to the email. If {safe_view} is present in the string, the file name of the attachment will be a “safe version” of the view used to create the report. This provides a means to: a) ensure that characters which may be illegal on some filesystems are not present in the report’s file name, and b) ensure that attachments have useful names based on the content of the report, as opposed to a fixed string.

Examples:

"subcribed_report" yields a file name of subscribed_report.pdf.

For the view Superstore/Overiview, a value of "{save_view}" yields a file name of superstore__overview.pdf.

For the view Superstore/Overiview, a value of "Tableau Report {save_view}" yields a file name of Tableau Report superstore__overview.pdf.

type

string

  • SubscriptionsSection

SubscriptionsSection

Configuration for a subscription job.

type

object

properties

  • subscriptions_input

Defines the location of the subscriptions table. This table is created and managed by the Portal.

Subscriptions_Input

allOf

InputSection

  • subscription_status_input

Defines the location of the subscriptions_status table. The table is created and managed by this job.

Subscription_Status_Input

allOf

InputSection

  • report_specification

Values to be used in processing all subscriptions. These are ultimately passed through to job_tableau_export.

Report_Specification

allOf

ReportSpecificationSection

  • TabcmdSection

TabcmdSection

Parameters used for each invocation of tabcmd export on each ReportSpecification.

type

object

properties

  • server

Server

Hostname or IP address of Tableau server.

type

string

  • site

Site

Tableau site.

type

string

  • user

User

Tableau user id.

type

string

  • password

Password

Password for Tableau user.

type

string

  • path

Path

Path to location of tabcmd on Mitto instance.

type

string

default

/opt/tableau/tabcmd/bin/tabcmd

  • timeout

Timeout

Maximum number of seconds to allow tabcmd to run before killing it.

type

integer

default

60

  • retries

Retries

Maximum number of times to retry a failed tabcmd.

type

integer

default

3

  • no_certcheck

No_Certcheck

If true, do not check TLS certificate validity of server.

type

boolean

default

True

  • port

Port

TCP/IP port tabcmd should use when contacting server.

type

integer

  • proxy

Proxy

Hostname or IP address of proxy to use when contacting server.

type

string

  • SmtpSection

SmtpSection

Defines the characteristics of the SMTP server that will be used to deliver exported reports.

type

object

properties

  • port

Port

The TCP/IP port to use for SMTP. See comment at require_tls.

type

integer

default

25

  • require_tls

Require_Tls

Use STARTTLS to establish secure transport. Note that this requires use of a non-TLS port to first establish communication. Often, this means that port should be set to 25 or 2525. Do not use the standard SMTP TLS port (e.g., 465).

type

boolean

default

False

  • server

Server

Hostname or IP address of server.

type

string

  • username

Username

SMTP user name.

type

string

  • password

Password

Password for SMTP user name.

type

string

  • disabled

Disabled

If True, email is not sent and the contents of this section are ignored. Primarily intended for testing.

type

boolean

default

False

  • ReportSpecification

ReportSpecification

Defines the contents of a single report.

type

object

properties

  • view

View

The Tableau view to use when creating the report. Views may contain spaces.

Example: If the Tableau URL is https://tableau.zuar.com/#/views/Superstore/Overview?:iid=1 then view is "Superstore/Overview".

type

string

  • report_type

Report_Type

The report’s format.

Examples:

"pdf"
"fullpdf"
"csv"
"png"

type

string

enum

pdf, csv, png, fullpdf

default

pdf

  • refresh

Refresh

type

boolean

default

False

  • height

Height

Height of the report image in pixels. Only valid when report_type is png.

type

integer

  • width

Width

Height of the report image in pixels. Only valid when if report_type is png.

type

integer

  • pagelayout

Pagelayout

The page orientation of the report.

Examples:

"landscape"
"portrait"

type

string

enum

landscape, protrait

default

landscape

  • pagesize

Pagesize

Assumed paper size to use when creating the report.

Examples:

"letter"
"a4"

type

string

enum

unspecified, letter, legal, note, folio, tabloid, ledger, statement, executive, a3, a4, a5, b4, b5, quarto

default

letter

  • report_name

Report_Name

The name given to the exported report when it is attached to outgoing email. When the recipient saves the attachment, it will be saved using this name. Do not provide an extension (e.g., use "ceo_report" instead of "ceo_report.pdf"; the correct extension will be provided by tabcmd export.

type

string

default

default_report_name

  • mail_subject

Mail_Subject

The subject line of the outgoing email.

Example:

"Q4 Results"

type

string

default

default_mail_subject

  • mail_from

Mail_From

The email address that will appear in the From: field of the outgoing email.

Example:

"steve@zuar.com"

type

string

  • mail_to

Mail_To

One or more comma-separated email addresses. The report will be emailed to the address(es).

Example:

"alice@foo.com,bob@foo.com,ted@bar.com"

type

string

  • mail_cc

Mail_Cc

CC recipients. Otherwise, same as mail_to.

type

string

  • mail_bcc

Mail_Bcc

BCC recipients. Otherwise, same as mail_to.

type

string

  • mail_body

Mail_Body

HTML which will be used as the body of the email.

Example:

"<html><head>CEO Report</head><body>Report attached.</body></head></html>"

type

string

default

This is the default email body.

  • disabled

Disabled

If True, the report defined by this specification is skipped.

Primarily for use with CSV input from a spreadsheet; it allows individual report specifications to be enabled/disabled without adding/removing rows from the spreadsheet.

type

boolean

default

False

  • ReportSpecificationsSection

ReportSpecificationsSection

Defines a section of the job’s JSON config containing the specifications for one or more reports that are to be exported and emailed.

type

object

properties

  • type

Type

The format used in providing one or more report specifications.

"json": The report specifications will come from the job’s JSON config.

"csv": The report specifications will come from a CSV formatted file.

"sql": The report specifications will come from the results of an SQL query.

type

string

enum

json, csv, sql

  • source

Provides the detailed specification for each report to be created.

If type is "json", source is a list of ReportSpecification or a valid JSON string representing a list of ReportSpecification.

Example:

"report_specifications": {
    "type": "json",
    "source": [
        {
            "view": "Superstore/Overview",
            "report_name": "report_name01",
            "mail_to": "steve@zuar.com",
            "mail_subject": "Report 01 is ready",
            "mail_from": "bob@zuar.com",
            "parameter_01": "Category",
            "value_01": '"Office Supplies"',
            "parameter_02": "State",
            "value_02": '["Texas", "Louisiana"]',
        },
        {
            "view": "Superstore/Overview",
            "report_name": "report_name02",
            "mail_to": "steve@zuar.com",
            "mail_subject": "Report 02 is ready",
            "mail_from": "bob@zuar.com",
            "parameter_01": "Category",
            "value_01": '["Furniture", "Office Supplies"]',
            "parameter_02": "State",
            "value_02": '"Louisiana"',
        }
    ]
}

If type is "csv", source is a path to a CSV file containing one report specification per row. The first row of the CSV file must be a header with column names corresponding to ReportSpecification attributes.

Example:

"report_specifications": {
    "type": "csv",
    "source": "/var/mitto/data/reports_01-02.csv"
}

Example contents of reports_01-02.csv:

view,report_type,pagelayout,pagesize,report_name,mail_to,mail_subject,mail_from,mail_cc,mail_bcc,parameter_01,value_01,parameter_02,value_02
Superstore/Overview,pdf,landscape,letter,khe_report_name01,khe@east.fm,keh subject 01,ke@east.fm,"kheaustin@gmail.com,kenneth.east@zuar.com",ke@east.fm,Category,""Office Supplies"",State,"[""Texas"", ""Louisiana""]"
Superstore/Overview,fullpdf,landscape,letter,Louisiana Report,"khe@east.fm,KHEAustin@gmail.com",keh subject 02,ke@east.fm,ke@east.fm,"kheaustin@gmail.com,kenneth.east@zuar.com",Category,"[""Furniture"", ""Office Supplies""]",State,""Louisiana""

If type is "sql", source is a SQL query that, when executed, will return one or more ReportSpecification. The SQL query can be either a single string containing the query or a list of strings that are concatenated to create the query.

The dbo attribute must be present when type is "sql".

Example:

"report_specifications": {
    "type": "sql",
    "source": [
        "SELECT",
        "'Superstore/Overview' AS view,",
        "'report_name01' AS report_name,",
        "'steve@zuar.com' AS mail_to,",
        "'Report 01 is ready' AS mail_subject,",
        "'bob@zuar.com' AS mail_from,",
        "'Category' AS parameter_01,",
        "'"Office Supplies"' AS value_01,",
        "'State' AS parameter_02,",
        "'["Texas", "Louisiana"]' AS value_02",
        "UNION ALL",
        "SELECT",
        "'Superstore/Overview' AS view,",
        "'report_name02' AS report_name,",
        "'steve@zuar.com' AS mail_to,",
        "'Report 02 is ready' AS mail_subject,",
        "'bob@zuar.com' AS mail_from,",
        "'Category' AS parameter_01,",
        "'["Furniture", "Office Supplies"]' AS value_01,",
        "'State' AS parameter_02,",
        "'"Louisiana"' AS value_02"
    ],
    "dbo": "postgresql://localhost/analytics"
}

Example:

"report_specifications": {
    "type": "sql",
    "source": "SELECT * FROM report_secification",
    "dbo": "postgresql://localhost/analytics"
}

Source

anyOf

type

array

items

anyOf

ReportSpecification

type

string

type

string

  • dbo

Dbo

The database dbo to use when executing an SQL query to obtain report specificaitons.

Example:

"postgresql://localhost/analytics"

type

string

  • specifications

For internal use only. Results are undefined if a value is provided via the job’s JSON config.

Specifications

  • TabcmdExportSection

TabcmdExportSection

This section of the JSON configuration and its subsections control the operation of job_tableau_export.

type

object

properties

  • tabcmd

Parameters used with tabcmd when processing each ReportSpecification in report_specifications.

Tabcmd

allOf

TabcmdSection

  • smtp

Parameters to be used when emailing each ReportSpecification in report_specifications.

Smtp

allOf

SmtpSection

  • report_specifications

Defines the source of the ReportSpecification used for exporting and emailing reports.

Report_Specifications

allOf

ReportSpecificationsSection