|
| 1 | +--- |
| 2 | +title: "Steampipe Table: github_repository_discussion - Query GitHub Repository Discussions using SQL" |
| 3 | +description: "Allows users to query GitHub Repository Discussions, providing insights into discussions, comments, and replies within repositories." |
| 4 | +folder: "Repository" |
| 5 | +--- |
| 6 | + |
| 7 | +# Table: github_repository_discussion - Query GitHub Repository Discussions using SQL |
| 8 | + |
| 9 | +GitHub Discussions are conversations that can be started by anyone and are organized into categories. They provide a place for having conversations that are not issues or pull requests. Discussions can be used to ask questions, share ideas, or have general conversations about a project. |
| 10 | + |
| 11 | +## Table Usage Guide |
| 12 | + |
| 13 | +The `github_repository_discussion` table provides insights into discussions within GitHub repositories. As a project manager or developer, explore discussion-specific details through this table, including comments, replies, categories, and associated metadata. Utilize it to uncover information about discussions, such as those with the most engagement, discussions by category, and the overall activity within a repository's discussion forum. |
| 14 | + |
| 15 | +To query this table using a [fine-grained access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token), the following permissions are required: |
| 16 | + |
| 17 | +- Repository permissions: |
| 18 | + - Discussions (Read-only): Required to access all columns. |
| 19 | + |
| 20 | +**Important Notes** |
| 21 | +- You must specify the `repository_full_name` (owner/repository) column in the `where` or `join` clause to query the table. |
| 22 | + |
| 23 | +## Examples |
| 24 | + |
| 25 | +### List discussions in a repository |
| 26 | +Explore the discussions within a specific GitHub repository to understand community engagement and topics being discussed. This can help in tracking community activity and identifying popular discussion topics. |
| 27 | + |
| 28 | +```sql+postgres |
| 29 | +select |
| 30 | + number, |
| 31 | + title, |
| 32 | + author_login, |
| 33 | + category_name, |
| 34 | + created_at, |
| 35 | + comments_total_count |
| 36 | +from |
| 37 | + github_repository_discussion |
| 38 | +where |
| 39 | + repository_full_name = 'turbot/steampipe'; |
| 40 | +``` |
| 41 | + |
| 42 | +```sql+sqlite |
| 43 | +select |
| 44 | + number, |
| 45 | + title, |
| 46 | + author_login, |
| 47 | + category_name, |
| 48 | + created_at, |
| 49 | + comments_total_count |
| 50 | +from |
| 51 | + github_repository_discussion |
| 52 | +where |
| 53 | + repository_full_name = 'turbot/steampipe'; |
| 54 | +``` |
| 55 | + |
| 56 | +### Get a specific discussion by number |
| 57 | +Retrieve detailed information about a specific discussion, including its full content, author details, and engagement metrics. This is useful for analyzing individual discussion threads and understanding their impact. |
| 58 | + |
| 59 | +```sql+postgres |
| 60 | +select |
| 61 | + number, |
| 62 | + title, |
| 63 | + author_login, |
| 64 | + category_name, |
| 65 | + created_at, |
| 66 | + comments_total_count, |
| 67 | + answer |
| 68 | +from |
| 69 | + github_repository_discussion |
| 70 | +where |
| 71 | + repository_full_name = 'turbot/steampipe' |
| 72 | + and number = 1007; |
| 73 | +``` |
| 74 | + |
| 75 | +```sql+sqlite |
| 76 | +select |
| 77 | + number, |
| 78 | + title, |
| 79 | + author_login, |
| 80 | + category_name, |
| 81 | + created_at, |
| 82 | + comments_total_count, |
| 83 | + answer |
| 84 | +from |
| 85 | + github_repository_discussion |
| 86 | +where |
| 87 | + repository_full_name = 'turbot/steampipe' |
| 88 | + and number = 1007; |
| 89 | +``` |
| 90 | + |
| 91 | +### Find discussions with answers |
| 92 | +Identify discussions that have been answered, which can help in understanding which topics have been resolved and which discussions have received helpful responses from the community. |
| 93 | + |
| 94 | +```sql+postgres |
| 95 | +select |
| 96 | + number, |
| 97 | + title, |
| 98 | + author_login, |
| 99 | + category_name, |
| 100 | + answer |
| 101 | +from |
| 102 | + github_repository_discussion |
| 103 | +where |
| 104 | + repository_full_name = 'turbot/steampipe' |
| 105 | + and answer is not null; |
| 106 | +``` |
| 107 | + |
| 108 | +```sql+sqlite |
| 109 | +select |
| 110 | + number, |
| 111 | + title, |
| 112 | + author_login, |
| 113 | + category_name, |
| 114 | + answer |
| 115 | +from |
| 116 | + github_repository_discussion |
| 117 | +where |
| 118 | + repository_full_name = 'turbot/steampipe' |
| 119 | + and answer is not null; |
| 120 | +``` |
| 121 | + |
| 122 | +### Find discussions by category |
| 123 | +Filter discussions by their category to focus on specific types of conversations, such as FAQs, feature requests, or general discussions. This helps in organizing and prioritizing community feedback. |
| 124 | + |
| 125 | +```sql+postgres |
| 126 | +select |
| 127 | + number, |
| 128 | + title, |
| 129 | + author_login, |
| 130 | + category_name, |
| 131 | + created_at |
| 132 | +from |
| 133 | + github_repository_discussion |
| 134 | +where |
| 135 | + repository_full_name = 'turbot/steampipe' |
| 136 | + and category_name = 'FAQ'; |
| 137 | +``` |
| 138 | + |
| 139 | +```sql+sqlite |
| 140 | +select |
| 141 | + number, |
| 142 | + title, |
| 143 | + author_login, |
| 144 | + category_name, |
| 145 | + created_at |
| 146 | +from |
| 147 | + github_repository_discussion |
| 148 | +where |
| 149 | + repository_full_name = 'turbot/steampipe' |
| 150 | + and category_name = 'FAQ'; |
| 151 | +``` |
| 152 | + |
| 153 | +### Get all comments for a discussion |
| 154 | +Retrieve all comments for a specific discussion to understand the full conversation thread and community engagement. This includes both the comment content and metadata about each comment. |
| 155 | + |
| 156 | +```sql+postgres |
| 157 | +select |
| 158 | + number, |
| 159 | + title, |
| 160 | + comments |
| 161 | +from |
| 162 | + github_repository_discussion |
| 163 | +where |
| 164 | + repository_full_name = 'turbot/steampipe' |
| 165 | + and number = 1007; |
| 166 | +``` |
| 167 | + |
| 168 | +```sql+sqlite |
| 169 | +select |
| 170 | + number, |
| 171 | + title, |
| 172 | + comments |
| 173 | +from |
| 174 | + github_repository_discussion |
| 175 | +where |
| 176 | + repository_full_name = 'turbot/steampipe' |
| 177 | + and number = 1007; |
| 178 | +``` |
| 179 | + |
| 180 | +### Get all replies for a discussion |
| 181 | +Retrieve all replies to comments in a specific discussion to understand the nested conversation structure and identify threads with high engagement. |
| 182 | + |
| 183 | +```sql+postgres |
| 184 | +select |
| 185 | + number, |
| 186 | + title, |
| 187 | + replies |
| 188 | +from |
| 189 | + github_repository_discussion |
| 190 | +where |
| 191 | + repository_full_name = 'turbot/steampipe' |
| 192 | + and number = 1007; |
| 193 | +``` |
| 194 | + |
| 195 | +```sql+sqlite |
| 196 | +select |
| 197 | + number, |
| 198 | + title, |
| 199 | + replies |
| 200 | +from |
| 201 | + github_repository_discussion |
| 202 | +where |
| 203 | + repository_full_name = 'turbot/steampipe' |
| 204 | + and number = 1007; |
| 205 | +``` |
| 206 | + |
| 207 | +### Find discussions with the most comments |
| 208 | +Identify the most active discussions in a repository by sorting by comment count. This helps in understanding which topics generate the most community engagement and discussion. |
| 209 | + |
| 210 | +```sql+postgres |
| 211 | +select |
| 212 | + number, |
| 213 | + title, |
| 214 | + author_login, |
| 215 | + comments_total_count |
| 216 | +from |
| 217 | + github_repository_discussion |
| 218 | +where |
| 219 | + repository_full_name = 'turbot/steampipe' |
| 220 | +order by |
| 221 | + comments_total_count desc |
| 222 | +limit 10; |
| 223 | +``` |
| 224 | + |
| 225 | +```sql+sqlite |
| 226 | +select |
| 227 | + number, |
| 228 | + title, |
| 229 | + author_login, |
| 230 | + comments_total_count |
| 231 | +from |
| 232 | + github_repository_discussion |
| 233 | +where |
| 234 | + repository_full_name = 'turbot/steampipe' |
| 235 | +order by |
| 236 | + comments_total_count desc |
| 237 | +limit 10; |
| 238 | +``` |
| 239 | + |
| 240 | +### Find recent discussions |
| 241 | +Identify recently created discussions to stay updated on the latest community activity and new topics being discussed in the repository. |
| 242 | + |
| 243 | +```sql+postgres |
| 244 | +select |
| 245 | + number, |
| 246 | + title, |
| 247 | + author_login, |
| 248 | + created_at |
| 249 | +from |
| 250 | + github_repository_discussion |
| 251 | +where |
| 252 | + repository_full_name = 'turbot/steampipe' |
| 253 | + and created_at > now() - interval '30 days' |
| 254 | +order by |
| 255 | + created_at desc; |
| 256 | +``` |
| 257 | + |
| 258 | +```sql+sqlite |
| 259 | +select |
| 260 | + number, |
| 261 | + title, |
| 262 | + author_login, |
| 263 | + created_at |
| 264 | +from |
| 265 | + github_repository_discussion |
| 266 | +where |
| 267 | + repository_full_name = 'turbot/steampipe' |
| 268 | + and created_at > datetime('now', '-30 days') |
| 269 | +order by |
| 270 | + created_at desc; |
| 271 | +``` |
0 commit comments