turbot / steampipe-plugin-jira

Use SQL to instantly query Jira. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/jira
Apache License 2.0
22 stars 14 forks source link

Add table jira_issue - issue-links #123

Closed agwilkinson closed 5 months ago

agwilkinson commented 5 months ago

Hi there,

Can you please add a data for "Issue Links" within the jira_issue table ?

The API is:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-links/#api-group-issue-links

Kind Regards

-Alex

ParthaI commented 5 months ago

Hello @agwilkinson, thank you for bringing this to our attention.

The details for issue links are already available under the fields column in the jira_issue table. Could you please execute the following query and let us know if it resolves your issue?

select
    ji.id,
    ji.title,
    ji.project_key,
    ji.status,
    il.issue_link_id,
    il.issue_link_self,
    il.issue_link_type_name,
    il.inward_issue_id,
    il.inward_issue_key,
    il.inward_issue_status_name,
    il.inward_issue_summary,
    il.inward_issue_priority_name
from
    jira_issue ji,
    lateral jsonb_array_elements(ji.fields -> 'issuelinks') as il_data,
    lateral (
        select
            il_data ->> 'id' as issue_link_id,
            il_data ->> 'self' as issue_link_self,
            il_data -> 'type' ->> 'name' as issue_link_type_name,
            il_data -> 'inwardIssue' ->> 'id' as inward_issue_id,
            il_data -> 'inwardIssue' ->> 'key' as inward_issue_key,
            il_data -> 'inwardIssue' -> 'fields' -> 'status' ->> 'name' as inward_issue_status_name,
            il_data -> 'inwardIssue' -> 'fields' ->> 'summary' as inward_issue_summary,
            il_data -> 'inwardIssue' -> 'fields' -> 'priority' ->> 'name' as inward_issue_priority_name
    ) as il

Thank you!

ParthaI commented 5 months ago

Closing this issue since the details for issue links are already included in the jira_issue table.

e-gineer commented 5 months ago

@ParthaI Nice - perhaps we should add this as en example for the table? I couldn't see any reference to the links on the table or examples when considering this question so didn't realize they were buried down in there!

ParthaI commented 5 months ago

Absolutely, @e-gineer, I'll include the example query in the table document. Thank you!