################################################################################
# Emailing the report owners
################################################################################
with open("archive_unused_reports.html.template", "r") as f:
  body_template = f.read()

for line in unique_emails:
  email = line[0]
  workbooks = map(lambda rec: rec['workbook'], list(line[1]))
  subj = 'Archiving unused Tableau Reports'
  body = body_template.format(
    archive_window = settings.ARCHIVE_WINDOW,
    contact        = settings.CONTACT_NAME,
    workbook_list  = ',</li><br><li>'.join(workbooks))

  sendEmail(settings.CONTACT_EMAIL, email, subj, body, isHTML=True)

################################################################################
# Downloading and deleting Reports
################################################################################
if not tabcmd_installed():
  print "tabcmd not found"
  exit()

for report in sorted(records, key = lambda rec: rec['url_namespace']):
  tableau_login(settings.TABADMIN_USER, settings.TABADMIN_PASSWORD,
    report['url_namespace'])
  report_uri = (settings.ARCHIVE_LOCATION +
    tab_url_to_filename(report['workbook']) + '.twb')

  get_cmd = [
예제 #2
0
query_template = load_template("error_email.sql.template")
query = query_template.format(default_owner=settings.CONTACT_HANDLE,
                              hour=settings.EXTRACT_ERROR_WINDOW_HOURS)

################################################################################
# Get query results
################################################################################
curs.execute(query)
records = list_dict([col.name for col in curs.description], curs.fetchall())

################################################################################
# Send emails
################################################################################
body_template = load_template("error_email.html.template")

for line in records:
    workbook_title = line['title']

    email_title = 'Action Required - Tableau Extracts Failing - {title}'\
      .format(title = workbook_title)

    body = body_template.format(workbook_title=workbook_title,
                                fail_time=line['time_since_failure_pst'],
                                error_message=line['notes'],
                                contact=settings.CONTACT_NAME,
                                contact2=settings.CONTACT_NAME_ALTERNATE)

    sendEmail(settings.CONTACT_EMAIL,
              line['wb_owner'] + '@' + settings.EMAIL_DOMAIN, email_title,
              body, True)
예제 #3
0
################################################################################
# Emailing the report owners
################################################################################
with open("archive_unused_reports.html.template", "r") as f:
  body_template = f.read()

for line in unique_emails:
  email = line[0]
  workbooks = map(lambda rec: rec['workbook'], list(line[1]))
  subj = 'Archiving unused Tableau Reports'
  body = body_template.format(
    archive_window = settings.ARCHIVE_WINDOW,
    contact        = settings.CONTACT_NAME,
    workbook_list  = ',</li><br><li>'.join(workbooks))

  sendEmail(settings.CONTACT_EMAIL, email, subj, body, isHTML=True)

################################################################################
# Downloading and deleting Reports
################################################################################
if not tabcmd_installed():
  print "tabcmd not found"
  exit()

for report in sorted(records, key = lambda rec: rec['url_namespace']):
  tableau_login(settings.TABADMIN_USER, settings.TABADMIN_PASSWORD,
    report['url_namespace'])
  path_concat(settings.ARCHIVE_LOCATION, url_to_file_name(report['workbook'],'twb'))

  get_cmd = [
      'tabcmd', 'get', '/workbooks/{0}.twb'.format(report['repository_url']),
예제 #4
0
################################################################################
# Get query results
################################################################################
curs.execute(query)
records = list_dict([col.name for col in curs.description], curs.fetchall())

################################################################################
# Send emails
################################################################################
body_template = load_template("error_email.html.template")

for line in records:
  workbook_title = line['title']

  email_title = 'Action Required - Tableau Extracts Failing - {title}'\
    .format(title = workbook_title)

  body = body_template.format(
    workbook_title = workbook_title,
    fail_time      = line['time_since_failure_pst'],
    error_message  = line['notes'],
    contact        = settings.CONTACT_NAME,
    contact2       = settings.CONTACT_NAME_ALTERNATE)

  sendEmail(settings.CONTACT_EMAIL,
    line['wb_owner'] + '@' + settings.EMAIL_DOMAIN,
    email_title,
    body,
    True)