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, descriptionfrom github_license;
select spdx_id, name, descriptionfrom 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, permissionsfrom 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_reposfrom github_license as l left join license_key as k on l.key = k.keygroup by l.nameorder 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_reposfrom github_license as l left join license_key as k on l.key = k.keygroup by l.nameorder 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_descfrom github_license, jsonb_array_elements(conditions) as cwhere key = 'gpl-3.0';
select name, l.key, json_extract(c.value, '$.Key') as condition, json_extract(c.value, '$.Description') as condition_descfrom github_license as l, json_each(conditions) as cwhere 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_descfrom github_license, jsonb_array_elements(limitations) as lwhere key = 'gpl-3.0';
select name, g.key, json_extract(l.value, '$.Key') as limitation, json_extract(l.value, '$.Description') as limitation_descfrom github_license as g, json_each(limitations) as lwhere 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_descfrom github_license, jsonb_array_elements(permissions) as pwhere key = 'gpl-3.0';
select name, l.key, json_extract(p.value, '$.Key') as permission, json_extract(p.value, '$.Description') as permission_descfrom github_license as l, json_each(permissions) as pwhere l.key = 'gpl-3.0';
Schema for github_license
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
conditions | jsonb | An array of license conditions (include-copyright,disclose-source, etc). | |
description | text | The license description. | |
featured | boolean | If true, the license is 'featured' in the GitHub UI. | |
hidden | boolean | Whether the license should be displayed in license pickers. | |
implementation | text | Implementation instructions for the license. | |
key | text | = | The unique key of the license. |
limitations | jsonb | An array of limitations for the license (trademark-use, liability,warranty, etc). | |
login_id | text | =, !=, ~~, ~~*, !~~, !~~* | Unique identifier for the user login. |
name | text | The name of the license. | |
nickname | text | The customary short name of the license. | |
permissions | jsonb | An array of permissions for the license (private-use, commercial-use,modifications, etc). | |
pseudo_license | boolean | Indicates if the license is a pseudo-license placeholder (e.g. other, no-license). | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
spdx_id | text | The Software Package Data Exchange (SPDX) id of the license. | |
url | text | The 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