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?
Oops. Prematurely sent this post. What I meant to ask is Tempo would fix the HTML withing XML problem or if they would give an option to bypass the Worklog Description?
Tim
Hi Tim,
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:
https://tempoplugin.jira.com/wiki/display/TEMPO/Tempo+Servlet+Manual#TempoServletManual-BillingKeyList
Hope this helps!
Thank you Benedikt. I have used the servlet and it is quite useful. I do have one question though. What is the linkage from the Jiraissue table, to account code. We only have 4 billing codes. If I could even find the link it would help my cause.
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,
-Bjarni
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.
Bjarni,
This gets me closer to my objective. I did find the accounts stored in property _entry and property_string. WooHoo! Now my challeng is to find the link from the worklog. I know there may be several hops but it still illudes me.
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.
Best regards,
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?
Sincerely,
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.
Is there a way to communicate to the Tempo folks to ask them for a code enhancement to fix web api? It would be nice if they fixed
Please create an issue in the Tempo tracker: https://tempoplugin.jira.com/browse/TT
Hi Bjarni If I would like to insert some tempo worklog attributes theought database, How I can do it ? Regards, Luis Yovera
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
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
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.
SELECTAO_C3C6E8_ACCOUNT_V1.`KEY` as AccountKey,concat(project.pkey , '-' , jiraissue.issuenum) AS Issue_Key ,jiraissue.id,jiraissue.pkey,project.pname AS project,jiraissue.summary,issuetype.pname AS issuetype,issuestatus.pname AS status,resolution.pname as resolution,jiraissue.assignee,jiraissue.reporter,jiraissue.created,jiraissue.UPDATED,jiraissue.resolutiondate,jiraissue.duedate,jiraissue.description,jiraissue.TimeSpent/60/60 as TimeSpentHour,issueComponent.components,(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 customfield2FROM jiraissue join project on jiraissue.project=project.IDjoin issuetype on jiraissue.issuetype=issuetype.IDjoin issuestatus on jiraissue.issuestatus=issuestatus.IDleft outer join ( select SOURCE_NODE_ID,GROUP_CONCAT(cname SEPARATOR ', ') components from componentinner join nodeassociation on component.id=nodeassociation.SINK_NODE_IDwhere ASSOCIATION_TYPE='IssueComponent'group by SOURCE_NODE_ID) issueComponenton issueComponent.SOURCE_NODE_ID=jiraissue.idleft outer join resolution on jiraissue.resolution=resolution.IDleft outer join customfieldvalue cfv1 on cfv1.customfield = 10100 and cfv1.ISSUE=jiraissue.idleft outer join AO_C3C6E8_ACCOUNT_V1 on AO_C3C6E8_ACCOUNT_V1.id=cfv1.NUMBERVALUEwhere jiraissue.UPDATED >'2018-05-20'limit 10
It looks like you're new here. Sign in or register to get started.