steampipe plugin install github

Table: github_license - Query GitHub Licenses using SQL

GitHub Licenses are a set of permissions that developers grant to others to study, distribute, and modify their software. These licenses allow the software to be freely used, modified, and shared. They are crucial to the open-source community as they ensure the software remains open-source, even after modifications.

Table Usage Guide

The github_license table provides insights into the different licenses used across GitHub repositories. As a software developer or open-source enthusiast, you can explore the specifics of these licenses through this table, including their permissions, conditions, and limitations. Use it to understand the terms under which you can use, modify, or distribute the software in question.

Examples

List basic license info

Explore the fundamental details of licensing in your GitHub repositories. This can help you ensure compliance with open source licensing requirements and understand the permissions associated with different licenses.

select
spdx_id,
name,
description
from
github_license;
select
spdx_id,
name,
description
from
github_license;

View license permissions

Explore the specific permissions associated with different licenses on GitHub. This helps in understanding the rights granted by each license, assisting users in making an informed choice when selecting a license for their project.

select
name,
jsonb_pretty(permissions)
from
github_license;
select
name,
permissions
from
github_license;

Count your repositories by license

Determine the number of your repositories grouped by their respective licenses. This is useful for understanding the distribution of license usage across your repositories.

with license_key as (
select
license_info ->> 'key' as key
from
github_my_repository
)
select
l.name,
count(k.key) as num_repos
from
github_license as l
left join license_key as k on l.key = k.key
group by
l.name
order by
num_repos desc;
with license_key as (
select
license_info ->> 'key' as key
from
github_my_repository
)
select
l.name,
count(k.key) as num_repos
from
github_license as l
left join license_key as k on l.key = k.key
group by
l.name
order by
num_repos desc;

View conditions for a specific license

Explore the specific conditions and their descriptions associated with a particular license on GitHub. This is particularly useful for understanding the terms of use and restrictions tied to a license before integrating it into your project.

select
name,
key,
c ->> 'Key' as condition,
c ->> 'Description' as condition_desc
from
github_license,
jsonb_array_elements(conditions) as c
where
key = 'gpl-3.0';
select
name,
l.key,
json_extract(c.value, '$.Key') as condition,
json_extract(c.value, '$.Description') as condition_desc
from
github_license as l,
json_each(conditions) as c
where
l.key = 'gpl-3.0';

View limitations for a specific license

Determine the restrictions associated with a specific software license, such as the 'gpl-3.0'. This is useful for understanding the terms and conditions that govern the use of the licensed software.

select
name,
key,
l ->> 'Key' as limitation,
l ->> 'Description' as limitation_desc
from
github_license,
jsonb_array_elements(limitations) as l
where
key = 'gpl-3.0';
select
name,
g.key,
json_extract(l.value, '$.Key') as limitation,
json_extract(l.value, '$.Description') as limitation_desc
from
github_license as g,
json_each(limitations) as l
where
g.key = 'gpl-3.0';

View permissions for a specific license

Explore the specific permissions associated with a particular software license. This can be useful when understanding the scope and limitations of a license before using or distributing software under its terms.

select
name,
key,
p ->> 'Key' as permission,
p ->> 'Description' as permission_desc
from
github_license,
jsonb_array_elements(permissions) as p
where
key = 'gpl-3.0';
select
name,
l.key,
json_extract(p.value, '$.Key') as permission,
json_extract(p.value, '$.Description') as permission_desc
from
github_license as l,
json_each(permissions) as p
where
l.key = 'gpl-3.0';

Schema for github_license

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
conditionsjsonbAn array of license conditions (include-copyright,disclose-source, etc).
descriptiontextThe license description.
featuredbooleanIf true, the license is 'featured' in the GitHub UI.
hiddenbooleanWhether the license should be displayed in license pickers.
implementationtextImplementation instructions for the license.
keytext=The unique key of the license.
limitationsjsonbAn array of limitations for the license (trademark-use, liability,warranty, etc).
login_idtext=, !=, ~~, ~~*, !~~, !~~*Unique identifier for the user login.
nametextThe name of the license.
nicknametextThe customary short name of the license.
permissionsjsonbAn array of permissions for the license (private-use, commercial-use,modifications, etc).
pseudo_licensebooleanIndicates if the license is a pseudo-license placeholder (e.g. other, no-license).
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
spdx_idtextThe Software Package Data Exchange (SPDX) id of the license.
urltextThe HTML URL of the license.

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_license