Table: bitbucket_pull_request - Query Bitbucket Pull Requests using SQL
Bitbucket Pull Requests is a feature within Bitbucket that allows developers to review code and discuss changes before merging into the main code base. It helps in maintaining code quality, fostering collaboration, and promoting a more transparent development process. With pull requests, teams can ensure that only thoroughly reviewed and approved code gets merged, reducing the risk of introducing bugs.
Table Usage Guide
The bitbucket_pull_request
table provides insights into pull requests within Bitbucket. As a developer or team lead, you can explore pull request details through this table, including the author, reviewers, status, and associated metadata. Utilize it to monitor the progress of code reviews, track the status of pull requests, and ensure efficient collaboration within your team.
Important Notes
- You must specify the
repository_full_name
in thewhere
clause to query this table.
Examples
List open pull requests in a repository
Explore which pull requests are currently open in a specific repository. This is useful to track ongoing changes and contributions to a project.
select repository_full_name, id, title, state, branch_name, author_display_namefrom bitbucket_pull_requestwhere repository_full_name = 'bitbucketpipelines/official-pipes' and state = 'OPEN';
select repository_full_name, id, title, state, branch_name, author_display_namefrom bitbucket_pull_requestwhere repository_full_name = 'bitbucketpipelines/official-pipes' and state = 'OPEN';
List the pull requests for a repository that have been merged in the last week
This query is useful for tracking recent changes in a specific repository, specifically identifying which pull requests have been merged in the past week. It provides valuable insights into the recent activity and contributor involvement, aiding in project management and review processes.
select repository_full_name, id, title, state, updated as merged_at, closed_by_display_name as merged_by_name, closed_by_uuid as merged_by_uuidfrom bitbucket_pull_requestwhere repository_full_name = 'bitbucketpipelines/official-pipes' and state = 'MERGED' and updated >= (current_date - interval '7' day)order by updated desc;
select repository_full_name, id, title, state, updated as merged_at, closed_by_display_name as merged_by_name, closed_by_uuid as merged_by_uuidfrom bitbucket_pull_requestwhere repository_full_name = 'bitbucketpipelines/official-pipes' and state = 'MERGED' and updated >= date('now', '-7 day')order by updated desc;
List the open PRs in a repository assigned to a specific user
Determine the open project requests assigned to a specific user within a particular repository. This is useful in tracking the workload and contributions of individual team members.
select repository_full_name, id, title, state, author_display_name, author_uuidfrom bitbucket_pull_requestwhere repository_full_name = 'bitbucketpipelines/official-pipes' and author_display_name = 'Tom Gibson' and state = 'OPEN';
select repository_full_name, id, title, state, author_display_name, author_uuidfrom bitbucket_pull_requestwhere repository_full_name = 'bitbucketpipelines/official-pipes' and author_display_name = 'Tom Gibson' and state = 'OPEN';
Schema for bitbucket_pull_request
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
author_display_name | text | Display name of the author of this pull request. | |
author_uuid | text | UUID of the author of this pull request. | |
branch_name | text | Name of the source branch for the pull request. | |
close_source_branch | boolean | A boolean flag indicating if merging the pull request closes the source branch. | |
closed_by_display_name | text | Display name of the user who closed this pull request. | |
closed_by_uuid | text | UUID of the user who closed of this pull request. | |
comment_count | bigint | The number of comments for a specific pull request. | |
created | timestamp with time zone | Timestamp when pull request was created. | |
description | text | Description of the pull request. | |
edited | timestamp with time zone | Timestamp when pull request was last edited. | |
id | bigint | = | The pull request's unique ID. Note that pull request IDs are only unique within their associated repository. |
merge_commit | text | Merge commit hash details for pull request. | |
participants | jsonb | List of collaborators on the pull request. | |
repository_full_name | text | = | The repository's full name. |
reviewers | jsonb | List of reviewers of the pull request. | |
self_link | text | A self link to this pull request. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
state | text | A current state of the pull request. Can be one of "MERGED", "SUPERSEDED", "OPEN" and "DECLINED". | |
summary | text | Summary details of the pull request. | |
task_count | bigint | The number of open tasks for a specific pull request. | |
title | text | Title of the resource. | |
type | text | Type of the Bitbucket resource. It will be always "pullrequest". | |
updated | timestamp with time zone | Timestamp when pull request was last updated. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- bitbucket
You can pass the configuration to the command with the --config
argument:
steampipe_export_bitbucket --config '<your_config>' bitbucket_pull_request