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

getSprint hydrate function #65

Closed jdevoo closed 2 years ago

jdevoo commented 2 years ago

Only the function getSprint from table_jira_sprint.go is relevant. It implements the hydrate function flagged as missing in the TODO above in the file. Helps with queries of type select * from jira_sprint where id=279

cbruno10 commented 2 years ago

Hey @jdevoo , I took the jira_sprint changes in this PR and tried them out, and found that the board_id column was sometimes being returned as 0 when using the Get call, but getting the actual board ID when using the List call:

> select * from jira_sprint
[
 {
  "_ctx": {
   "connection_name": "jira"
  },
  "board_id": 4,
  "complete_date": null,
  "end_date": null,
  "id": 6,
  "name": "TEST1 Sprint 1",
  "self": "https://turbot-turbot.atlassian.net/rest/agile/1.0/sprint/6",
  "start_date": null,
  "state": "future",
  "title": "TEST1 Sprint 1"
 },
 {
  "_ctx": {
   "connection_name": "jira"
  },
  "board_id": 2,
  "complete_date": null,
  "end_date": "2021-06-24T04:54:00-04:00",
  "id": 3,
  "name": "Lalit Sprint 2",
  "self": "https://turbot-turbot.atlassian.net/rest/agile/1.0/sprint/3",
  "start_date": "2021-06-17T04:54:54-04:00",
  "state": "active",
  "title": "Lalit Sprint 2"
 },
 {
  "_ctx": {
   "connection_name": "jira"
  },
  "board_id": 2,
  "complete_date": "2021-06-17T04:51:41-04:00",
  "end_date": "2021-06-07T22:19:05-04:00",
  "id": 1,
  "name": "Sample Sprint 2",
  "self": "https://turbot-turbot.atlassian.net/rest/agile/1.0/sprint/1",
  "start_date": "2021-05-24T21:59:05-04:00",
  "state": "closed",
  "title": "Sample Sprint 2"
 },
 {
  "_ctx": {
   "connection_name": "jira"
  },
  "board_id": 2,
  "complete_date": "2021-05-24T19:29:05-04:00",
  "end_date": "2021-05-24T20:49:05-04:00",
  "id": 2,
  "name": "Sample Sprint 1",
  "self": "https://turbot-turbot.atlassian.net/rest/agile/1.0/sprint/2",
  "start_date": "2021-05-10T20:49:05-04:00",
  "state": "closed",
  "title": "Sample Sprint 1"
 }
]
> select * from jira_sprint where id = 2
[
 {
  "_ctx": {
   "connection_name": "jira"
  },
  "board_id": 0,
  "complete_date": "2021-05-24T19:29:05-04:00",
  "end_date": "2021-05-24T20:49:05-04:00",
  "id": 2,
  "name": "Sample Sprint 1",
  "self": "https://turbot-turbot.atlassian.net/rest/agile/1.0/sprint/2",
  "start_date": "2021-05-10T20:49:05-04:00",
  "state": "closed",
  "title": "Sample Sprint 1"
 }
]

When board_id is 0, I believe this is the default value from the SDK when there is no value for the column. So I don't believe that the Get call from the SDK we're using always returns the board ID (from the originBoardId property).

Also, I'm not sure we always want to map the originBoardId property to the current board_id column, as I found a discussion in https://community.atlassian.com/t5/Jira-questions/originBoardId-in-Sprint-does-not-map-back-to-id-in-Board/qaq-p/1461728, where a user states:

Apparently originBoardId is the "Rapid View" #, not the "board id" used in the API.

I'm not very familiar with rapid views, but I'm not sure if this number would match the board IDs we currently get back from the list calls.

Are you familiar with rapid views and the IDs associated with them?

cbruno10 commented 2 years ago

@jdevoo Based on my comments above, I'm closing this PR for now, as I don't believe it would be helpful to add a GetConfig to the jira_sprint table, since we'd lose the board_id column, whereas today, we can get that column (provided we do a list call).

Please re-open this PR if you have anymore information to my questions above or any other questions, thanks!