Skip to content

Add the github_project_v2 table - #548

Merged
cbruno10 merged 1 commit into
turbot:mainfrom
dark-panda:add-project-v2-table
Oct 12, 2026
Merged

cbruno10 merged 1 commit into
turbot:mainfrom
dark-panda:add-project-v2-table

Conversation

@dark-panda

@dark-panda dark-panda commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds a table called github_project_v2 that contains some of the fields exposed by the GraphQL API for ProjectV2 and adds a few fields to github_issue to allow you to join the two tables together. We're using the github_project_v2 name here rather than github_project because of existing fields in tables like github_team and github_organization that reference projects_v2_total_count and such.

Example queries:

=> select * from github_project_v2 where organization = 'turbot' ;
-[ RECORD 1 ]------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------
login_id                 | MDQ6VXNlcjg0Nzgz
organization             | turbot
user_login               | <NULL>
number                   | 14
id                       | 10217986
node_id                  | PVT_kwDOAlEJmM4Am-oC
owner                    | {"id": 38865304, "type": "Organization", "login": "turbot"}
creator                  | {"url": "https://github.com/apps/github-project-automation", "login": "github-project-automation", "avatar_url": "https://avatars.githubusercontent.com/in/235829?v=4"}
title                    | Issue Management
description              |
is_public                | t
closed_at                | 2026-06-08 13:57:12+00
created_at               | 2024-08-29 03:57:44+00
updated_at               | 2026-06-08 13:57:12+00
state                    | closed
latest_status_update     | <NULL>
is_template              | f
readme                   | Tracking all examples required by end users
resource_path            | /orgs/turbot/projects/14
url                      | https://github.com/orgs/turbot/projects/14
repositories             | ["turbot/guardrails-samples"]
repositories_total_count | 1
teams                    | ["", ""]
teams_total_count        | 2
sp_connection_name       | github
sp_ctx                   | {"steampipe": {"sdk_version": "5.14.0"}, "connection_name": "github"}
_ctx                     | {"steampipe": {"sdk_version": "5.14.0"}, "connection_name": "github"}

=> select
  i.id,
  i.title,
  p.title as project_title,
  p.state as project_state,
  p.id as project_id
from
  github_issue i,
  jsonb_array_elements(i.projects_v2) as project
  join github_project_v2 p on p.node_id = project ->> 'node_id'
where
  i.repository_full_name = 'turbot/guardrails-samples'
  and p.organization = 'turbot';
     id     |                           title                            |  project_title   | project_state | project_id
------------+------------------------------------------------------------+------------------+---------------+------------
 1016873038 | TrimBot - Fix the version for dependent libraries          | Issue Management | closed        |   10217986
  815566711 | SecHub - Feature - SecHub needs a heartbeat                | Issue Management | closed        |   10217986
  966420924 | TrimBot - SNS topics not all removed                       | Issue Management | closed        |   10217986
  966422959 | TrimBot - Error handling should be more verbose            | Issue Management | closed        |   10217986
  841771067 | GraphQL - Get the details of a policy such as descriptions | Issue Management | closed        |   10217986
  966425300 | Calculated Policy - Log Group Deletions                    | Issue Management | closed        |   10217986

=> select
  organization,
  number,
  title,
  state,
  is_public,
  created_at
from
  github_project_v2
where
  organization = 'turbot';
 organization | number |      title       | state  | is_public |       created_at
--------------+--------+------------------+--------+-----------+------------------------
 turbot       |     14 | Issue Management | closed | t         | 2024-08-29 03:57:44+00

=> select
  organization,
  number,
  title,
  created_at,
  updated_at
from
  github_project_v2
where
  organization = 'turbot'
  and state = 'open';
 organization | number | title | created_at | updated_at
--------------+--------+-------+------------+------------
(0 rows)

=> select
  number,
  title,
  description,
  owner,
  creator
from
  github_project_v2
where
  organization = 'turbot'
  and number = 14;
-[ RECORD 1 ]------------------------------------------------------------------------------------------------------------------------------------------------------------------------
number      | 14
title       | Issue Management
description |
owner       | {"id": 38865304, "type": "Organization", "login": "turbot"}
creator     | {"url": "https://github.com/apps/github-project-automation", "login": "github-project-automation", "avatar_url": "https://avatars.githubusercontent.com/in/235829?v=4"}

=> select
  number,
  title,
  updated_at
from
  github_project_v2
where
  organization = 'turbot'
  and updated_at >= now() - interval '30 days'
order by
  updated_at desc;
 number | title | updated_at
--------+-------+------------
(0 rows)

=> select
  number,
  title,
  repositories,
  repositories_total_count,
  teams,
  teams_total_count
from
  github_project_v2
where
  organization = 'turbot';
 number |      title       |         repositories          | repositories_total_count |  teams   | teams_total_count
--------+------------------+-------------------------------+--------------------------+----------+-------------------
     14 | Issue Management | ["turbot/guardrails-samples"] |                        1 | ["", ""] |                 2
(1 row)

=> select
  number,
  title,
  latest_status_update ->> 'status' as status,
  latest_status_update ->> 'body' as body,
  latest_status_update ->> 'created_at' as reported_at
from
  github_project_v2
where
  organization = 'turbot';
 number |      title       | status |  body  | reported_at
--------+------------------+--------+--------+-------------
     14 | Issue Management | <NULL> | <NULL> | <NULL>
(1 row)

=> select
  user_login,
  number,
  title,
  state,
  is_public,
  created_at
from
  github_project_v2
where
  user_login = 'octocat';
 user_login | number | title | state | is_public | created_at
------------+--------+-------+-------+-----------+------------
(0 rows)

@cbruno10 cbruno10 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.go and table_github_project_v2.go both fail gofmt -l, can you please check these files?

If you have any questions, please let us know!

Comment thread github/table_github_project_v2.go
Comment thread github/table_github_project_v2.go Outdated
Comment thread github/table_github_project_v2.go
Comment thread github/table_github_issue.go Outdated
@dark-panda
dark-panda force-pushed the add-project-v2-table branch 2 times, most recently from 7c1c288 to f98e304 Compare August 17, 2026 18:36
@dark-panda
dark-panda force-pushed the add-project-v2-table branch 3 times, most recently from 835f9de to 7eeb984 Compare August 20, 2026 17:29

@cbruno10 cbruno10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dark-panda Thanks for the latest updates and sorry for the late response. I've left a few additional review comments, can you please have a look when you get a chance? Thanks!

Comment thread github/models/project_v2.go Outdated
Comment thread github/table_github_issue.go Outdated
Comment thread github/models/project_v2.go
Comment thread github/table_github_project_v2.go Outdated
Comment thread github/table_github_project_v2.go
Comment thread github/table_github_project_v2.go Outdated
Comment thread github/models/project_v2.go
Comment thread github/table_github_project_v2.go Outdated
Comment thread docs/tables/github_project_v2.md
Comment thread github/models/misc.go
@dark-panda

Copy link
Copy Markdown
Contributor Author

@cbruno10 feedback applied, let's see how this looks now.

@dark-panda
dark-panda requested a review from cbruno10 October 6, 2026 13:20
Comment thread docs/tables/github_project_v2.md Outdated
Comment thread docs/tables/github_project_v2.md Outdated
Comment thread github/table_github_actions_artifact.go Outdated
Comment thread github/table_github_issue.go Outdated
@cbruno10

cbruno10 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@dark-panda - Thanks for working through the last round of feedback! I've tested the table again and added a few more suggestions in the most recent review. Can you please have a look when you get a chance?

Also, can you please update the PR description? It still has the older owner and teams output, and the join example uses project_items, which has been replaced by projects_v2. Results from the table doc examples would be great.

Thanks!

@dark-panda
dark-panda force-pushed the add-project-v2-table branch from 6114b59 to 96c9650 Compare October 8, 2026 13:52
@dark-panda

Copy link
Copy Markdown
Contributor Author

@cbruno10 feedback addressed, how's it looking?

@cbruno10
cbruno10 merged commit 11db4dc into turbot:main Oct 12, 2026
1 check failed
@cbruno10

Copy link
Copy Markdown
Contributor

@dark-panda Thanks again for all the work on this new table, it's now out in v1.11.0!

Along with your changes, I made a few others in the plugin as well:

  • I removed the projects_v2 and projects_v2_total_count columns from github_issue and added a github_project_v2_item table to avoid making a breaking change to the github_issue table, as those new columns would require additional project read permissions.
  • This new table also returns pull requests and draft issues, and it has each item's project field values (like Status and Iteration) in field_values.

To get the same results as the original join example in this PR, you can list the org's projects and then get the items in each one:

with projects as materialized (
  select
    number,
    title,
    state,
    id
  from
    github_project_v2
  where
    organization = 'turbot'
)
select
  i.content_id as id,
  i.title,
  p.title as project_title,
  p.state as project_state,
  p.id as project_id
from
  projects p
  join github_project_v2_item i on i.project_number = p.number
where
  i.organization = 'turbot'
  and i.repository_full_name = 'turbot/guardrails-samples'
  and i.type = 'ISSUE';

A few notes on the query above:

  • github_project_v2_item requires project_number and either organization or user_login, so you need to set the organization on both tables. The materialized keyword makes Postgres list the projects first, then the items in each project.
  • content_id is the same value as the issue's id. If you need other issue columns, like state_reason, you can join to github_issue on repository_full_name and number.
  • Since the query starts from projects, an issue only shows up in projects owned by the org or user you query. If your issues are in projects owned by more than one org or user, you'll need to query each owner.
  • The table docs have more examples, including filtering by status and joining with github_issue and github_pull_request - https://hub.steampipe.io/plugins/turbot/github/tables/github_project_v2_item

However, if this doesn't cover something you were doing with the old columns, please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants