What is the TEMPO database table relationship between worklogs, Issues, and billing accounts?

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?

8 answers

1 accepted

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,

Please create an issue in the Tempo tracker: https://tempoplugin.jira.com/browse/TT

Best regards,

-Bjarni

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.

Hi Tim,

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.

Tim

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,

-Bjarni

Bjarni,

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,

Tim

Hi Tim,

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,

-Bjarni

Hi Bjarni If I would like to insert some tempo worklog attributes theought database, How I can do it ? Regards, Luis Yovera

Bjarni,

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

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

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
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

768 views 2 19
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