Add the github_project_v2 table#548
Conversation
There was a problem hiding this comment.
@dark-panda Thanks for raising this PR! I've added a few suggestions and questions in this PR. A few other minor points:
- Can you please add a table doc page for
docs/tables/github_project_v2.md? - Can you please also update the PR description, which have different (possibly older) columns? I think it'd be helpful to see the results of the example queries from the upcoming table doc.
- Locally,
models/project_v2.goandtable_github_project_v2.goboth failgofmt -l, can you please check these files?
If you have any questions, please let us know!
| { | ||
| Name: "updated_at", | ||
| Require: plugin.Optional, | ||
| Operators: []string{">", ">="}, |
There was a problem hiding this comment.
Does the List function use the updated_at qual? Looking at the GraphQL projectsV2 field, I don't see a way to filter on the updated at time either, so not sure if we can filter on this field at the API layer.
|
|
||
| func sharedProjectV2Columns() []*plugin.Column { | ||
| return []*plugin.Column{ | ||
| {Name: "number", Type: proto.ColumnType_INT, Transform: transform.FromField("Number", "Node.Number"), Description: "The project number."}, |
There was a problem hiding this comment.
Does the API ever return the data under Node.Number?
| ShouldIgnoreError: isNotFoundError([]string{"404"}), | ||
| Hydrate: tableGitHubProjectV2List, | ||
| }, | ||
| Get: &plugin.GetConfig{ |
There was a problem hiding this comment.
Does the GetConfig work correctly when passing in organization and number?
KeyColumns requires organization and number, but the hydrate reads quals["id"] (never populated, so it's 0) and queries projectV2(id: $projectId). Looking at the GraphQL schema, Organization.projectV2 only accepts number, so this errors server-side with Unknown argument 'id'.
I think the Get function should use quals["number"] and use graphql:"projectV2(number: $number)" instead.
| {Name: "user_did_author", Type: proto.ColumnType_BOOL, Hydrate: issueHydrateUserDidAuthor, Transform: transform.FromValue(), Description: "If true, user authored the issue."}, | ||
| {Name: "user_subscription", Type: proto.ColumnType_STRING, Hydrate: issueHydrateUserSubscription, Transform: transform.FromValue(), Description: "Subscription state of the user to the issue."}, | ||
| {Name: "assignees", Type: proto.ColumnType_JSON, Hydrate: issueHydrateAssignees, Transform: transform.FromValue().NullIfZero(), Description: "A list of Users assigned to the issue."}, | ||
| {Name: "project_items", Type: proto.ColumnType_JSON, Hydrate: issueHydrateProjectItems, Transform: transform.FromValue().NullIfZero(), Description: "A list of project node IDs (PVT_...) for ProjectV2 projects the issue belongs to."}, |
There was a problem hiding this comment.
| {Name: "project_items", Type: proto.ColumnType_JSON, Hydrate: issueHydrateProjectItems, Transform: transform.FromValue().NullIfZero(), Description: "A list of project node IDs (PVT_...) for ProjectV2 projects the issue belongs to."}, | |
| {Name: "projects_v2", Type: proto.ColumnType_JSON, Hydrate: issueHydrateProjectItems, Transform: transform.FromValue().NullIfZero(), Description: "A list of ProjectV2 projects associated with the issue."}, |
For this column, similar to assignees and labels, I think we should return more project data, including its scalar fields as part of the project object. So we can reuse the ProjectV2 model you already defined and include its scalar fields:
idnode_idnumbertitledescriptionstateis_publiccreated_atupdated_atclosed_at
Notably, we should skip the pageable connections (items/fields/views), and @include-gate anything heavy like latest_status_update. Users can still join on node_id, but now get titles/state without one.
Can you please also add a projects_v2_total_count column with the description Count of ProjectV2 projects associated with the issue.? The model already fetches ProjectItems.TotalCount, so it's basically free, and it matches the existing projects_v2_total_count columns in the github_organization and github_team tables.
This PR adds a table called
github_project_v2that contains some of the fields exposed by the GraphQL API for ProjectV2 and adds a few fields togithub_issueto allow you to join the two tables together. We're using thegithub_project_v2name here rather thangithub_projectbecause of existing fields in tables likegithub_teamandgithub_organizationthat referenceprojects_v2_total_countand such.Example queries: