I am trying to write an SQL query to collect various time-logged statistics. Time spent is stored in the Worklog table. It appears to me that the WORKLOG table has a key into the Jiraissue table via the issueid. The Jiraissue table has valuable information but I cannot see the link or location to where the Billing Account codes are stored. I have defined 4 accounts and linked projects and issues to these accounts. What I want to do is group (in SQL) by account. Can anyone help?
I write this query to fetch my issue with account key. you have to amend AO_C3C6E8_ACCOUNT_V1 as it has diffrent value based on your installation and also custom field value of 10100 with is associated with your tempo account based on your installation.
AO_C3C6E8_ACCOUNT_V1.`KEY` as AccountKey,
concat(project.pkey , '-' , jiraissue.issuenum) AS Issue_Key ,
project.pname AS project,
issuetype.pname AS issuetype,
issuestatus.pname AS status,
resolution.pname as resolution,
jiraissue.TimeSpent/60/60 as TimeSpentHour,
(select cfv1.textvalue from customfieldvalue cfv1 where cfv1.issue = jiraissue.id and cfv1.customfield = 10100) as customfield1
-- (select cfv2.numbervalue from customfieldvalue cfv2 where cfv2.issue = jiraissue.id and cfv2.customfield = 10101)as customfield2
FROM jiraissue join project on jiraissue.project=project.ID
join issuetype on jiraissue.issuetype=issuetype.ID
join issuestatus on jiraissue.issuestatus=issuestatus.ID
left outer join ( select SOURCE_NODE_ID,GROUP_CONCAT(cname SEPARATOR ', ') components from component
inner join nodeassociation on component.id=nodeassociation.SINK_NODE_ID
group by SOURCE_NODE_ID) issueComponent
left outer join resolution on jiraissue.resolution=resolution.ID
left outer join customfieldvalue cfv1 on cfv1.customfield = 10100 and cfv1.ISSUE=jiraissue.id
left outer join AO_C3C6E8_ACCOUNT_V1 on AO_C3C6E8_ACCOUNT_V1.id=cfv1.NUMBERVALUE
where jiraissue.UPDATED >'2018-05-20'
This thread is a bit old, but I just had to work through modifying all of our Tempo Account keys and the worklogs associated with them. I've written about that here: https://medium.com/atlassian-adventures/changing-account-keys-in-jira-tempo-accounts-b3eb5a2d7de3
The issue and worklog tables are JIRA tables.
The Tempo account data is stored in a proprietary XML format that we can change the format/layout at any time. We do not support any direct access or manipulation of the data, but we do provide a simple servlet that returns a list of the accounts, see this site for further info:
Hope this helps!
The issue account is a normal custom field and is stored in the JIRA custom field tables. I didn't find your exact query, but here are some SQL examples that you can work from: https://confluence.atlassian.com/display/JIRACOM/Example+SQL+queries+for+JIRA#ExampleSQLqueriesforJIRA-GetCustomStringFieldforanIssue%28SqlServerfunction%29
Hope this helps,
P.S. If you are using the account as a worklog attribute, you need to query the property_entry and property_string tables by the worklog_id.
You join the worklog.id to the propertyentry.entity_id and the propertyentry.id to propertystring.id. Something like this:
select ps.propertyvalue from propertyentry pe, propertystring ps, worklog w, jiraissue ji where ji.pkey = 'TMA-3014' and ji.id = w.issueid and w.id = pe.entity_id and pe.entity_name = 'Tempo.Worklog' and pe.property_key = 'Tempo.WorklogAttributes' and pe.id = ps.id
Please note that is SQL is not supported and we will change this structure in the future.
Thank you for your quick reply.
For some reason we do not ave any propertyentry.Entity_Name with a value 'Tempo.Worklog'. We do have 'Tempo.Billing or 'Tempo.Config'.
Also, we have been trying to use the servlet but are receiving errors because our users are including HTML data in the Worklog Description. The error is something caused by HTML inside XML.
Is there a way we can prevent the Servlet from returning the Worklog Description?
The Tempo worklog attributes are currently stored as 'Tempo.Worklog' entries. If you don't have those you are not using the Tempo worklog attributes for the accounts but simply the JIRA custom field and you should therefore check the JIRA SQL page that I sent you before. You have probably stumbled up on the accounts config.
I don't think you can currently skip the worklog description from the servlet export.
Hope this helps,
Thanks Eric, The attributes and the accounts are indeed cached and that is why you didn't see the changes in the UI immediately. (DB changes like these should never be done on a live system to avoid cache corruption.) Thanks for sharing and glad it worked for you :) -Bjarni
In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to have–in order to produce a reliable long-term roadmap. We're tur...
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!
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