Sprint Scope Changes via SQL

Is there a way to tell via the DB, what issues have been added and removed from a sprint? I'm hoping I can do it for an open sprint but a closed sprint would be better than nothing.

This information is available somewhere it seems as the sprint reports pull the necessary information.

2 answers

1 accepted

CHANGEITEM and CHANGEGROUP tell you when the customfield value related to the sprint changes and hence what's added/removed based on the time. The SQL below is what I'm using to get the items added and removed while the sprint is in progress.

Hope that helps.

select sprint.name sprint_name,
sprint.start_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') start_date,
sprint.complete_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') complete_date,
'REMOVED' action, i.pkey issue_key
from changeitem ci, changegroup cg, ao_60DB71_sprint sprint, jiraissue i
where ci.field = 'Sprint' and ci.groupid = cg.id
and instr(replace(','||to_char(ci.oldvalue)||',',' ',''),',' || sprint.id || ',') > 0
and instr(replace(','||to_char(ci.newvalue)||',',' ',''),',' || sprint.id || ',') = 0
and cg.created between
sprint.start_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') and
nvl(sprint.complete_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM'),sysdate + 21)
and sprint.start_date is not null
and cg.issueid = i.id
and not exists (select 1 from issuetype it where i.issuetype = it.id and it.pstyle = 'jira_subtask')
union all
select sprint.name,
sprint.start_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') start_date,
sprint.complete_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') complete_date,
'ADDED' action, i.pkey issue_key
from changeitem ci, changegroup cg, ao_60DB71_sprint sprint, jiraissue i
where ci.field = 'Sprint' and ci.groupid = cg.id
and instr(replace(','||to_char(ci.oldvalue)||',',' ',''),',' || sprint.id || ',') = 0
and instr(replace(','||to_char(ci.newvalue)||',',' ',''),',' || sprint.id || ',') > 0
and cg.created between
sprint.start_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') and
nvl(sprint.complete_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM'),sysdate + 21)
and sprint.start_date is not null
and cg.issueid = i.id
and not exists (select 1 from issuetype it where i.issuetype = it.id and it.pstyle = 'jira_subtask')

Were you ever able to find an answer to this? I'd like to do the same thing.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Sarah Schuster
Posted Mar 28, 2018 in Jira Software

Can a company’s culture make or break agile adoption?

Can a new-to-agile team survive and thrive in a non-agile culture? If so, what advice would you give to those trying to be agile in a non-agile culture? What's the key(s) to success? Share your thoug...

13,178 views 15 13
Join discussion

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