jimjim
jimjim

Reputation: 101

Can you monitor the progress of an incremental refresh in Tableau programmatically?

Am I missing something? I need to monitor the progress of an incremental refresh so when it finishes another process kicks off. Is there anyway to do this?

Upvotes: 0

Views: 806

Answers (1)

jimjim
jimjim

Reputation: 101

I don't know how I over looked this, but I did. There is a column called job_name in the _background_tasks table. I thought "Refresh Extracts" was the only indicator, but there is also a value called "Increment Extracts". Here is a Python script to find those the incremental refresh jobs with whether they succeeded, their progress, the name of the extract, and the time they completed once they are finished. I'm using Python 2.7. I hope someone finds this useful.

import psycopg2


try:
    conn = psycopg2.connect("dbname='database' user='user' host='localhost' password='password' "
                        "port='portnumber'")
    cur = conn.cursor()
    cur.execute("SELECT finish_code, progress, title, completed_at FROM _background_tasks where job_name = 'Increment "
            "Extracts' and POSITION('my_incremental_extract' IN title) > 0")

    query_result = cur.fetchall()
    for row in query_result:
        if row[0] == 0:
            print 'Finished succesfully'
        else:
            print 'Failed'
        print 'Progress: ' + str(row[1])
        print 'Job: ' + row[2]
        print 'Time completed: ' + str(row[3])
        print '*******************************************new record*****************************************' 
except Exception as tb_ex:
    print tb_ex

Upvotes: 0

Related Questions