Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events