Skip to main content

codeql_databases

Creates, updates, deletes, gets or lists a codeql_databases resource.

Overview

Namecodeql_databases
TypeResource
Idgithub.code_scanning.codeql_databases

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idintegerThe ID of the CodeQL database.
namestringThe name of the CodeQL database.
commit_oidstringThe commit SHA of the repository at the time the CodeQL database was created.
content_typestringThe MIME type of the CodeQL database file.
created_atstring (date-time)The date and time at which the CodeQL database was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.
languagestringThe language of the CodeQL database.
sizeintegerThe size of the CodeQL database file in bytes.
updated_atstring (date-time)The date and time at which the CodeQL database was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.
uploaderobjectA GitHub user. (title: Simple User)
urlstring (uri)The URL at which to download the CodeQL database. The Accept header must be set to the value of the content_type property.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_codeql_databaseselectowner, repo, languageGets a CodeQL database for a language in a repository.

By default this endpoint returns JSON metadata about the CodeQL database. To
download the CodeQL database binary content, set the Accept header of the request
to application/zip, and make sure
your HTTP client is configured to follow redirects or use the Location header
to make a second request to get the redirect URL.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.
list_codeql_databasesselectowner, repoLists the CodeQL databases that are available in a repository.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.
delete_codeql_databasedeleteowner, repo, languageDeletes a CodeQL database for a language in a repository.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
languagestringThe language of the CodeQL database.
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.

SELECT examples

Gets a CodeQL database for a language in a repository.

By default this endpoint returns JSON metadata about the CodeQL database. To
download the CodeQL database binary content, set the Accept header of the request
to application/zip, and make sure
your HTTP client is configured to follow redirects or use the Location header
to make a second request to get the redirect URL.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.

SELECT
id,
name,
commit_oid,
content_type,
created_at,
language,
size,
updated_at,
uploader,
url
FROM github.code_scanning.codeql_databases
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND language = '{{ language }}' -- required
;

DELETE examples

Deletes a CodeQL database for a language in a repository.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.

DELETE FROM github.code_scanning.codeql_databases
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND language = '{{ language }}' --required
;