turbot/bitbucket
steampipe plugin install bitbucket

Table: bitbucket_my_repository - Query Bitbucket Repositories using SQL

Bitbucket is a web-based version control repository hosting service owned by Atlassian, for source code and development projects that use either Mercurial or Git revision control systems. Bitbucket offers both commercial plans and free accounts. It provides a way for developers to manage and maintain their code, with features such as pull requests, branching, and in-line commenting.

Table Usage Guide

The bitbucket_my_repository table provides insights into repositories within Bitbucket. As a developer or project manager, explore repository-specific details through this table, including repository name, project key, size, and other metadata. Utilize it to uncover information about repositories, such as those with the most recent commits, the size of each repository, and the associated project key.

Important Notes

  • To query ANY repository, including public repositories, use the bitbucket_repository table.

Examples

List of repositories that you or your workspace owns

Explore the repositories that you or your workspace own, to manage and organize your projects better. This allows you to assess the ownership of different repositories, enhancing your control and coordination over them.

select
name,
uuid,
full_name,
owner_display_name
from
bitbucket_my_repository
order by
full_name;
select
name,
uuid,
full_name,
owner_display_name
from
bitbucket_my_repository
order by
full_name;

List your public repositories

Explore which of your Bitbucket repositories are publicly accessible. This can be useful to ensure sensitive information is not inadvertently exposed.

select
name,
is_private,
full_name,
owner_display_name
from
bitbucket_my_repository
where
not is_private;
select
name,
is_private,
full_name,
owner_display_name
from
bitbucket_my_repository
where
not is_private;

List the unassigned open issues in your repositories

Discover the segments that have unresolved issues in your repositories that are yet to be assigned. This is useful for identifying potential bottlenecks in your workflow, allowing you to take remedial action and improve efficiency.

select
i.repository_full_name,
i.id,
i.title,
i.state,
i.assignee_display_name,
i.assignee_uuid
from
bitbucket_issue as i,
bitbucket_my_repository as r
where
repository_full_name = r.full_name
and i.assignee_uuid is null
and i.state = 'new';
Error: The corresponding SQLite query is unavailable.

List details of the default reviewers of your repositories

Gain insights into who are set as default reviewers for your repositories, helpful in understanding the review process and ensuring the right people are involved in code reviews.

with default_reviewers as (
select
full_name as repository_name,
r ->> 'AccountId' as reviewer_account_id,
r ->> 'Uuid' as reviewer_uuid,
r ->> 'DisplayName' as reviewer_display_name,
r ->> 'Type' as reviewer_type
from
bitbucket_my_repository,
jsonb_array_elements(default_reviewers) as r
)
select
repository_name,
reviewer_account_id,
reviewer_uuid,
reviewer_display_name,
reviewer_type
from
default_reviewers;
with default_reviewers as (
select
full_name as repository_name,
json_extract(r.value, '$.AccountId') as reviewer_account_id,
json_extract(r.value, '$.Uuid') as reviewer_uuid,
json_extract(r.value, '$.DisplayName') as reviewer_display_name,
json_extract(r.value, '$.Type') as reviewer_type
from
bitbucket_my_repository,
json_each(default_reviewers) as r
)
select
repository_name,
reviewer_account_id,
reviewer_uuid,
reviewer_display_name,
reviewer_type
from
default_reviewers;

List the repositories without default reviewers

Discover the segments that have repositories without designated default reviewers. This is useful for identifying potential areas of oversight, ensuring that all repositories have appropriate review processes in place.

select
name,
uuid,
full_name,
owner_display_name
from
bitbucket_my_repository
where
default_reviewers is null;
select
name,
uuid,
full_name,
owner_display_name
from
bitbucket_my_repository
where
default_reviewers is null;

Schema for bitbucket_my_repository

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
default_reviewersjsonbDetails of the default reviewers of the repository.
descriptiontextDescription of the repository.
fork_policytextControls the rules for forking this repository. "allow_forks": unrestricted forking, "no_public_forks": restrict forking to private forks (forks cannot be made public later) and "no_forks": deny all forking
full_nametextThe concatenation of the repository owner's username and the slugified name, e.g. "turbot/steampipe-plugin-bitbucket". This is the same string used in Bitbucket URLs.
has_issuestextTo initialize or disable the new repo's issue tracker
is_privatebooleanIndicates whether the repository is publicly accessible, or whether it is private to the team and consequently only visible to team members.
languagetextThe type of markup language the raw content is to be interpreted in.
mainbranchjsonbDetails of the main branch of the repository.
nametextThe name of repository.
owner_account_idtextJira account id of the owner.
owner_display_nametextDisplay name of the owner the repository.
owner_typetextType of the owner of the repository. Can be a user or team.
owner_uuidtextBitbucket UUID of the owner.
project_keytextKey of the project this repository belongs to.
project_nametextName of the project this repository belongs to.
project_uuidtextUUID of the project this repository belongs to.
self_linktextSelf link to this repository.
slugtextA repository slug is a URL-friendly version of a repository name, automatically generated by Bitbucket for use in the URL.
titletextTitle of the resource.
uuidtextThe repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user.

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_my_repository