Table: github_blob - Query GitHub Repositories using SQL
GitHub Repositories are a fundamental resource in GitHub. They allow users to host and manage their codebase, track changes, and collaborate with other users. Each repository contains a tree structure that represents the file and directory hierarchy.
Table Usage Guide
The github_blob
table provides the contents of files within GitHub Repositories. As a developer or project manager, explore each repository's contents. Utilize it to uncover information about specific files in the repository, such as configuration files.
Important Notes
- You must specify the
repository_full_name
andblob_sha
columns inwhere
orjoin
clause to query the table.
Examples
List blob contents for a specific file
Explore the specific elements within the 'turbot/steampipe' repository by pinpointing specific files using a unique identifier. This helps understand the contents of the repository and makes it easy to access and analyze the file's content.
select tree_sha, truncated, path, mode, type, sha, decode(content, encoding) as contentfrom github_tree t left outer join github_blob b on b.repository_full_name = t.repository_full_name and b.blob_sha = t.shawhere t.repository_full_name = 'turbot/steampipe' and tree_sha = '0f200416c44b8b85277d973bff933efa8ef7803a' and path = 'Makefile';
select tree_sha, truncated, path, mode, type, sha, decode(content, encoding) as contentfrom github_tree t left outer join github_blob b on b.repository_full_name = t.repository_full_name and b.blob_sha = t.shawhere t.repository_full_name = 'turbot/steampipe' and tree_sha = '0f200416c44b8b85277d973bff933efa8ef7803a' and path = 'Makefile';
Schema for github_blob
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
blob_sha | text | = | SHA1 of the blob. |
content | text | The encoded content of the blob. | |
encoding | text | The encoding of the blob. | |
node_id | text | The node ID of the blob. | |
repository_full_name | text | = | Full name of the repository that contains the blob. |
size | bigint | Size of the blob. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
url | text | URL of the blob. |
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)" -- github
You can pass the configuration to the command with the --config
argument:
steampipe_export_github --config '<your_config>' github_blob