Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JQL issue search different between Python and browser

Caitlin Walter
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2024

Hey team, I have this query.

created >= -156w AND (due >= -104w OR due = null) AND project = Dashboard ORDER BY key DESC

When I run it in the browser at {mycompany}.atlassian.net/issues/?jql=created >%3D -156w AND (due >%3D -104w OR due %3D null) AND project %3D Dashboard ORDER BY key DESC I get 1828 issues

 

When I run it in Python, I only get 928 issues. Python code is below.  Why the discrepancy when I copied and pasted the JQL from one to the other?

 

from jira import JIRA

import re

jiraOptions = {'server': "https://mycompany.atlassian.net"}

jira = JIRA(options = jiraOptions,

            basic_auth = ("myemail",

                          "mytoken"))

issues = []

batch_size = 200

index = 0

while index < 5000:

    issue_batch = jira.search_issues('created >= -156w AND (due >= -104w OR due = null) AND project = Dashboard ORDER BY key DESC', startAt=index, maxResults=batch_size)

    print(f"Issues {index} through {index + batch_size-1}")

    issues.extend(issue_batch)

    index += batch_size

with open ("issues.txt", 'w', encoding='utf-8') as file:

    for issue in issues:

        file.write(f"{issue.key}\n")

1 answer

0 votes
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2024

It seems you're splitting the result in half because you get more data in maxResult compared to your browser. Your code uses maxResult 200, try using 100 as batchsize and see if you get the same result with the browser.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events