JIRA to Tableau in two lines of Python
Recently, I had to create one status dashboard for a JIRA project. Tableau does not connect to JIRA out of the box and you need to purchase a connector to get this functionality. Since JIRA has a REST API, my initial instinct was to build a web data connector. But it turns out that you can get the JIRA data to Tableau in two lines of python code.
I ended up with writing a python script that runs every hour and dump the JIRA data to a json file. Tableau can consume json file easily and it works for both JIRA cloud and server. Here is the essence of my script.
from jira import JIRA
jira = JIRA(server="yourserver",
# Get all issues in project
issues = jira.search_issues('project=yourproject',maxResults=sys.maxsize)
# Keep only raw data
cleaned_list = [issue.raw for issue in issues]
# Dump cleaned list as a json file
with open('result.json','w')as fp:
I know what you are thinking; this is not two lines! Well, it can be written in two lines if you dont care about code styling or PEP-8 compliance.
with open('result.json','w')as fp:json.dump([issue.raw for issue in jira.JIRA(server="yourserver",auth=('uid','pwd')).search_issues('project=yourproject',maxResults=sys.maxsize)],fp)
Remember to select all schema levels when making the connection in Tableau.
Here is a preview of the available fields after creating the connection.