API import issue when the field is empty

I am using the JIRA API to pull ticket details and put it in a separate database that I can connect Tableau to.

My problem is that when pulling in a ticket details (using python) where e.g. it has no priority, that I get an error.

How do I get around that error? How can I handle this error?

 

Just currently testing by printing the details on-screen:

 

for issue in issues:
if verbose:
            print( "issue.key: ", issue.key );
            print( "issue.fields.project.id: ", issue.fields.project.id );

The error I get is: 

cursor.execute(sql_stmt, (issue.key, issue.fields.issuetype.name, issue.fields.project.name, issue.fields.summary, issue.fields.updated,issue.fields.priority.name))
AttributeError: type object 'PropertyHolder' has no attribute 'priority

 

 

1 answer

The following worked for me:

if verbose:
try:
print( "issue.key: ", issue.key );
print( "issue.fields.project.id: ", issue.fields.project.id );
except AttributeError:
 key = None

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 8 hours ago in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

146 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you