Skip to content

GitLab

GitLab projects, merge requests, issues, CI pipelines, jobs and logs as SQL tables

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/gitlab/index.md to help me query GitLab with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Every subgroup of gitlab-org

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT full_path, visibility
FROM gitlab.main.groups(parent := 'gitlab-org')
ORDER BY full_path

Quick start

Choose where to run GitLab, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'gitlab' AS gitlab (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-gitlab-worker'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

gitlab credentials

Access to one GitLab instance's REST API v4: an access token and, for self-managed GitLab, the instance's base URL (default https://gitlab.com).

Get these credentials β†’
secret.sql
CREATE SECRET gitlab (
    TYPE gitlab,
    token    '<GITLAB_TOKEN>',  -- secret
    base_url '<base_url>',
    send_as  '<send_as>',
    per_page '<per_page>',
    timeout  '<timeout>'
);
Credential fields and requirements β†’

4. Run a query

query.sql
SELECT full_path, visibility
FROM gitlab.main.groups(parent := 'gitlab-org')
ORDER BY full_path
More example queries β†’
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'gitlab' AS gitlab (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-gitlab-worker'
);

Overview

GitLab (gitlab.com and self-managed) as read-only SQL: groups, projects, issues, merge requests, commits, releases, CI/CD pipelines, jobs, job logs and deployments, with GitHub-compatible column names.

ATTACH options

projects
Comma-separated project paths that gitlab.unified.runs / task_runs cover when a query names none, e.g. 'gitlab-org/cli,gitlab-org/gitlab-runner'.VARCHAR
group_path
Group path whose (non-archived, subgroup-inclusive) projects the unified tables cover when a query names none, e.g. 'gitlab-org/ci-cd'.VARCHAR

Catalog

Everything gitlab exposes once attached β€” read straight from the worker's released build.

gitlab 2 schemas
main 21 functions

GitLab REST resources as table functions: projects, issues, merge requests, CI and more.

Schema examples (21)
Examples (21)

Every subgroup of gitlab-org

SELECT full_path, visibility
FROM gitlab.main.groups(parent := 'gitlab-org')
ORDER BY full_path;

The most-starred active projects of gitlab-org

SELECT full_name, stargazers_count, last_activity_at
FROM gitlab.main.projects('gitlab-org')
WHERE NOT is_archived AND last_activity_at >= TIMESTAMPTZ '2026-10-01'
ORDER BY stargazers_count DESC
LIMIT 10;

Stars, forks and license of one project

SELECT full_name, stargazers_count, forks_count, license_key
FROM gitlab.main.project('gitlab-org/gitlab-runner');

Maintainers and owners of a project

SELECT login, access_level_name
FROM gitlab.main.members('gitlab-org/gitlab-runner')
WHERE access_level >= 40
ORDER BY login;
17 more examples

The newest open bugs of a project

SELECT number, title, user_login, created_at
FROM gitlab.main.issues('gitlab-org/gitlab-runner', labels := 'bug')
WHERE state = 'open'
ORDER BY created_at DESC
LIMIT 20;

The human comments on an issue

SELECT user_login, created_at, body
FROM gitlab.main.issue_notes('gitlab-org/cli', 1)
WHERE NOT is_system
ORDER BY created_at;

How quickly merge requests get merged

SELECT count(*) AS merged,
  median(date_diff('hour', created_at, merged_at)) AS median_hours
FROM gitlab.main.merge_requests('gitlab-org/cli')
WHERE gitlab_state = 'merged' AND merged_at >= TIMESTAMPTZ '2026-10-01';

Who commented on a merge request

SELECT user_login, count(*) AS comments
FROM gitlab.main.merge_request_notes('gitlab-org/cli', 1)
WHERE NOT is_system
GROUP BY user_login
ORDER BY comments DESC;

Merged merge requests that nobody approved

SELECT m.number, a.approved_by
FROM gitlab.main.merge_requests('gitlab-org/cli') m,
     LATERAL gitlab.main.merge_request_approvals(m.repo, m.number) a
WHERE m.gitlab_state = 'merged' AND len(a.approved_by) = 0;

Size of a merge request

SELECT count(*) AS files, sum(additions) AS added, sum(deletions) AS removed
FROM gitlab.main.merge_request_diff_stats('gitlab-org/cli', 1);

Most active authors since October

SELECT author_name, count(*) AS commits
FROM gitlab.main.commits('gitlab-org/cli')
WHERE committer_date >= TIMESTAMPTZ '2026-10-01'
GROUP BY author_name
ORDER BY commits DESC
LIMIT 10;

Merged branches that could be deleted

SELECT name, commit_date
FROM gitlab.main.branches('gitlab-org/cli')
WHERE is_merged AND NOT is_protected
ORDER BY commit_date
LIMIT 20;

v1 tags without a release

SELECT name, commit_date
FROM gitlab.main.tags('gitlab-org/cli', search := '^v1.')
WHERE NOT has_release
ORDER BY commit_date DESC;

The ten latest releases

SELECT tag_name, published_at
FROM gitlab.main.releases('gitlab-org/cli')
WHERE NOT is_upcoming
ORDER BY published_at DESC
LIMIT 10;

Top ten contributors

SELECT name, contributions
FROM gitlab.main.contributors('gitlab-org/cli')
ORDER BY contributions DESC
LIMIT 10;

Failure counts per branch this month

SELECT ref, count(*) AS pipelines,
  count(*) FILTER (WHERE status = 'failed') AS failed
FROM gitlab.main.pipelines('gitlab-org/cli')
WHERE updated_at >= TIMESTAMPTZ '2026-11-01'
GROUP BY ref
ORDER BY failed DESC;

Failed jobs of one pipeline

SELECT name, failure_reason, duration_seconds
FROM gitlab.main.jobs('gitlab-org/cli', pipeline_id := 1234567)
WHERE status = 'failed'
ORDER BY name;

Error lines of a failed job

SELECT line_number, message
FROM gitlab.main.job_log('gitlab-org/cli', 9876543)
WHERE message ILIKE '%error%'
ORDER BY line_number;

The slowest steps of a job

SELECT section, duration_seconds
FROM gitlab.main.job_log_sections('gitlab-org/cli', 9876543)
ORDER BY duration_seconds DESC;

Environments that are up

SELECT name, tier, external_url
FROM gitlab.main.environments('gitlab-org/cli')
WHERE state = 'available'
ORDER BY name;

Weekly production deployment frequency

SELECT date_trunc('week', created_at) AS week, count(*) AS deploys
FROM gitlab.main.deployments('gitlab-org/cli')
WHERE environment = 'production' AND status = 'success'
GROUP BY ALL
ORDER BY week;
Table functions
branches (project VARCHAR, search := VARCHAR) 1 example

Branches of a GitLab project with their tip commit and protection state

Positional arguments
project VARCHAR
Project path 'group/name' or numeric id.
Named arguments
search := VARCHAR
Only names containing this text; '^x' means starts with, 'x$' ends with. Β· default null
Returns columns
repo VARCHAR
Project path.
name VARCHAR
Branch name. `name =` is pushed down.
commit_sha VARCHAR
Commit at the tip of the branch.
commit_title VARCHAR
Title of that commit.
commit_date TIMESTAMP WITH TIME ZONE
When that commit was committed.
is_default BOOLEAN
Whether this is the default branch.
is_protected BOOLEAN
Whether the branch is protected.
is_merged BOOLEAN
Whether the branch is merged into the default branch.
developers_can_push BOOLEAN
Whether developers may push to it.
html_url VARCHAR
Link to the branch in the GitLab UI.
Example

Merged branches that could be deleted

SELECT name, commit_date
FROM gitlab.main.branches('gitlab-org/cli')
WHERE is_merged AND NOT is_protected
ORDER BY commit_date
LIMIT 20;
Link
commits (project VARCHAR, all_refs := BOOLEAN, path := VARCHAR, ref := VARCHAR, since := VARCHAR, until := VARCHAR, with_stats := BOOLEAN) 2 examples

Commit history of a GitLab project, newest first

Positional arguments
project VARCHAR
Project path 'group/name' or numeric id.
Named arguments
all_refs := BOOLEAN
List commits reachable from every ref. Β· default false
path := VARCHAR
Only commits touching this file or directory. Β· default null
ref := VARCHAR
Git ref whose history to list, e.g. 'main' or 'v1.2.0'; NULL means the default branch. Β· default null
since := VARCHAR
Only commits at or after this ISO 8601 instant, e.g. '2026-01-01'. Β· default null
until := VARCHAR
Only commits at or before this ISO 8601 instant. Β· default null
with_stats := BOOLEAN
Fill additions/deletions (GitLab computes them; slower). Β· default false
Returns columns
repo VARCHAR
Project path the commit was listed from.
sha VARCHAR
Full commit hash.
short_sha VARCHAR
Abbreviated hash, as GitLab shows it.
title VARCHAR
First line of the commit message.
message VARCHAR
Full commit message.
author_name VARCHAR
Author name from the git metadata. Pushed down (author).
author_email VARCHAR
Author email from the git metadata.
author_date TIMESTAMP WITH TIME ZONE
When the change was originally authored.
committer_name VARCHAR
Committer name from the git metadata.
committer_email VARCHAR
Committer email from the git metadata.
committer_date TIMESTAMP WITH TIME ZONE
When the commit was committed. Ranges are pushed down (since/until).
parent_shas VARCHAR[]
Parent hashes; more than one means a merge commit.
additions BIGINT
Lines added (only with with_stats := true).
deletions BIGINT
Lines removed (only with with_stats := true).
html_url VARCHAR
Link to the commit in the GitLab UI.
Examples (2)

Most active authors since October

SELECT author_name, count(*) AS commits
FROM gitlab.main.commits('gitlab-org/cli')
WHERE committer_date >= TIMESTAMPTZ '2026-10-01'
GROUP BY author_name
ORDER BY commits DESC
LIMIT 10;

Recent changes to one file and their size

SELECT sha, title, additions + deletions AS churn
FROM gitlab.main.commits('gitlab-org/cli', path := 'README.md', with_stats := true)
ORDER BY committer_date DESC
LIMIT 5;
Link
contributors (project VARCHAR) 1 example

Contributors to a GitLab project's default branch, ranked by commits

Arguments
project VARCHAR
Project path 'group/name' or numeric id, e.g. 'gitlab-org/cli'.
Returns columns
repo VARCHAR
Project path.
name VARCHAR
Contributor name from the git metadata.
email VARCHAR
Contributor email from the git metadata.
contributions BIGINT
Commits to the default branch by this name/email.
additions BIGINT
Lines added (GitLab reports 0 on recent versions).
deletions BIGINT
Lines removed (GitLab reports 0 on recent versions).
Example

Top ten contributors

SELECT name, contributions
FROM gitlab.main.contributors('gitlab-org/cli')
ORDER BY contributions DESC
LIMIT 10;
Link
deployments (project VARCHAR) 1 example

Deployments of a GitLab project to its environments, newest first

Arguments
project VARCHAR
Project path 'group/name' or numeric id, e.g. 'gitlab-org/cli'.
Returns columns
repo VARCHAR
Project path.
id BIGINT
Deployment id.
iid BIGINT
Per-project deployment number.
environment VARCHAR
Environment name deployed to. Pushed down.
environment_id BIGINT
Environment id.
status VARCHAR
created, running, success, failed, canceled, skipped or blocked. Pushed down.
ref VARCHAR
Branch or tag deployed.
sha VARCHAR
Commit deployed.
user_login VARCHAR
Who deployed.
job_id BIGINT
The deploy job (deployable).
job_name VARCHAR
Its name.
pipeline_id BIGINT
The pipeline the deploy job belongs to.
created_at TIMESTAMP WITH TIME ZONE
When the deployment was created.
updated_at TIMESTAMP WITH TIME ZONE
When it last changed. Ranges are pushed down.
finished_at TIMESTAMP WITH TIME ZONE
When the deploy job finished.
Example

Weekly production deployment frequency

SELECT date_trunc('week', created_at) AS week, count(*) AS deploys
FROM gitlab.main.deployments('gitlab-org/cli')
WHERE environment = 'production' AND status = 'success'
GROUP BY ALL
ORDER BY week;
Link
environments (project VARCHAR, search := VARCHAR) 1 example

Deployment environments of a GitLab project

Positional arguments
project VARCHAR
Project path 'group/name' or numeric id.
Named arguments
search := VARCHAR
Only environments whose name contains this text. Β· default null
Returns columns
repo VARCHAR
Project path.
id BIGINT
Environment id.
name VARCHAR
Environment name, e.g. 'production' or 'review/feature-x'. Pushed down.
slug VARCHAR
URL-safe name.
tier VARCHAR
production, staging, testing, development or other.
state VARCHAR
'available', 'stopping' or 'stopped'. Pushed down.
external_url VARCHAR
Where the environment is reachable.
html_url VARCHAR
Link to the environment in the GitLab UI.
created_at TIMESTAMP WITH TIME ZONE
When the environment was created.
updated_at TIMESTAMP WITH TIME ZONE
When it last changed.
auto_stop_at TIMESTAMP WITH TIME ZONE
When it will be stopped automatically, if scheduled.
Example

Environments that are up

SELECT name, tier, external_url
FROM gitlab.main.environments('gitlab-org/cli')
WHERE state = 'available'
ORDER BY name;
Link
groups (all_available := BOOLEAN, parent := VARCHAR, search := VARCHAR) 2 examples

GitLab groups you can see, or the descendant groups of one group

Named arguments
all_available := BOOLEAN
true: every group you can see (default on self-managed for admins); false: only your memberships. Β· default null
parent := VARCHAR
List the descendant groups of this group path instead of all groups. Β· default null
search := VARCHAR
Only groups whose name or path contains this text. Β· default null
Returns columns
id BIGINT
GitLab's numeric group id.
full_path VARCHAR
Path including parent groups, e.g. 'gitlab-org/ci-cd'; what projects() takes.
path VARCHAR
The group's own URL slug.
name VARCHAR
Display name.
full_name VARCHAR
Display name including parent groups, e.g. 'GitLab.org / CI-CD'.
description VARCHAR
Group description.
visibility VARCHAR
'public', 'internal' or 'private'.
parent_id BIGINT
Id of the parent group; NULL for a top-level group.
html_url VARCHAR
Link to the group in the GitLab UI.
created_at TIMESTAMP WITH TIME ZONE
When the group was created.
Examples (2)

Every subgroup of gitlab-org

SELECT full_path, visibility
FROM gitlab.main.groups(parent := 'gitlab-org')
ORDER BY full_path;

Groups matching 'data', counted by visibility

SELECT visibility, count(*) AS groups
FROM gitlab.main.groups(search := 'data')
GROUP BY visibility
ORDER BY groups DESC;
Link
issue_notes (project VARCHAR, number BIGINT) 1 example

Notes (comments and system events) on one GitLab issue, oldest first

Arguments
project VARCHAR
Project path 'group/name' or id.
number BIGINT
The issue or merge request iid (the number column).
Returns columns
repo VARCHAR
Project path the note belongs to.
number BIGINT
iid of the issue or merge request the note is on.
id BIGINT
GitLab's note id.
user_login VARCHAR
Username of the note's author.
body VARCHAR
Note text as Markdown (system notes describe events, e.g. 'added 1 commit').
is_system BOOLEAN
Whether GitLab generated the note (label changes, pushes, ...).
is_internal BOOLEAN
Whether the note is internal (visible to project members only).
is_resolvable BOOLEAN
Whether the note starts a resolvable thread.
is_resolved BOOLEAN
Whether its thread is resolved.
resolved_by_login VARCHAR
Who resolved the thread.
created_at TIMESTAMP WITH TIME ZONE
When the note was posted.
updated_at TIMESTAMP WITH TIME ZONE
When the note was last edited.
Example

The human comments on an issue

SELECT user_login, created_at, body
FROM gitlab.main.issue_notes('gitlab-org/cli', 1)
WHERE NOT is_system
ORDER BY created_at;
Link
issues (project VARCHAR, labels := VARCHAR, search := VARCHAR) 2 examples

Issues of a GitLab project or group, newest first, with filters pushed to the API

Positional arguments
project VARCHAR
Project path 'group/name' (or id), or a group path for all its projects.
Named arguments
labels := VARCHAR
Comma-separated labels; an issue must carry all of them. Β· default null
search := VARCHAR
Only issues whose title or description contains this text. Β· default null
Returns columns
repo VARCHAR
Project path 'group/name' the issue belongs to.
number BIGINT
Issue iid within the project β€” what issue_notes() takes. Pushed down.
id BIGINT
GitLab's instance-wide issue id.
title VARCHAR
Issue title.
state VARCHAR
'open' or 'closed' (GitHub vocabulary). Pushed down.
gitlab_state VARCHAR
GitLab's own state: 'opened' or 'closed'. Pushed down.
user_login VARCHAR
Username of the author. Pushed down (author_username).
labels VARCHAR[]
Labels applied; filter with the `labels` argument to push down.
assignees VARCHAR[]
Usernames of the assignees.
milestone VARCHAR
Milestone title. Pushed down.
comments BIGINT
Number of user (non-system) notes.
reactions_plus_one BIGINT
Thumbs-up (upvote) count.
downvotes BIGINT
Thumbs-down count.
is_locked BOOLEAN
Whether the discussion is locked.
is_confidential BOOLEAN
Whether the issue is confidential. Pushed down.
issue_type VARCHAR
'issue', 'incident', 'test_case' or 'task'.
weight BIGINT
Issue weight, if set (Premium).
due_date DATE
Due date, if set.
closed_by_login VARCHAR
Username of whoever closed the issue.
body VARCHAR
Description as Markdown.
html_url VARCHAR
Link to the issue in the GitLab UI.
created_at TIMESTAMP WITH TIME ZONE
When the issue was opened. Ranges are pushed down.
updated_at TIMESTAMP WITH TIME ZONE
When the issue last changed. Ranges are pushed down.
closed_at TIMESTAMP WITH TIME ZONE
When the issue was closed; NULL while open.
Examples (2)

The newest open bugs of a project

SELECT number, title, user_login, created_at
FROM gitlab.main.issues('gitlab-org/gitlab-runner', labels := 'bug')
WHERE state = 'open'
ORDER BY created_at DESC
LIMIT 20;

Issues closed per month and how long they stayed open

SELECT date_trunc('month', closed_at) AS month, count(*) AS closed,
  median(date_diff('day', created_at, closed_at)) AS median_days
FROM gitlab.main.issues('gitlab-org/cli')
WHERE state = 'closed' AND created_at >= TIMESTAMPTZ '2026-01-01'
GROUP BY ALL
ORDER BY month;
Link
job_log (project VARCHAR, job_id BIGINT) 2 examples

A GitLab CI job's log as clean lines with timestamp, stream and section

Arguments
project VARCHAR
Project path 'group/name' or numeric id.
job_id BIGINT
Job id (the id column of jobs()).
Returns columns
repo VARCHAR
Project path.
job_id BIGINT
Job id.
line_number BIGINT
1-based line number after cleaning (marker-only lines removed).
timestamp TIMESTAMP WITH TIME ZONE
When the runner captured the line (timestamped logs, GitLab 17.1+); else NULL.
stream VARCHAR
'stdout' or 'stderr' (timestamped logs only); else NULL.
section VARCHAR
Innermost collapsible section, e.g. 'step_script' or 'prepare_executor'.
section_path VARCHAR[]
Every open section, outermost first.
message VARCHAR
The line's text without ANSI escapes or section markers.
is_section_header BOOLEAN
Whether the line is a section's header line.
Examples (2)

Error lines of a failed job

SELECT line_number, message
FROM gitlab.main.job_log('gitlab-org/cli', 9876543)
WHERE message ILIKE '%error%'
ORDER BY line_number;

Failing test lines across a pipeline's failed jobs

SELECT j.name, l.message
FROM gitlab.main.jobs('gitlab-org/cli', pipeline_id := 1234567) j,
     LATERAL gitlab.main.job_log(j.repo, j.id) l
WHERE j.status = 'failed' AND l.section = 'step_script' AND l.message LIKE '%FAIL%';
Link
job_log_sections (project VARCHAR, job_id BIGINT) 1 example

The collapsible sections of a GitLab CI job's log with their durations

Arguments
project VARCHAR
Project path 'group/name' or numeric id.
job_id BIGINT
Job id (the id column of jobs()).
Returns columns
repo VARCHAR
Project path.
job_id BIGINT
Job id.
section VARCHAR
Section name, e.g. 'step_script'.
parent VARCHAR
Enclosing section, if nested.
depth INTEGER
Nesting depth (0 = top level).
header VARCHAR
The section's header text, e.g. 'Executing "step_script" stage'.
started_at TIMESTAMP WITH TIME ZONE
When the section started (from its marker).
ended_at TIMESTAMP WITH TIME ZONE
When it ended; NULL if the log stops inside it.
duration_seconds DOUBLE
ended_at - started_at in seconds (marker resolution: 1 s).
first_line BIGINT
First job_log line_number inside the section.
last_line BIGINT
Last job_log line_number inside the section.
is_collapsed BOOLEAN
Whether the section is collapsed by default ([collapsed=true]).
Example

The slowest steps of a job

SELECT section, duration_seconds
FROM gitlab.main.job_log_sections('gitlab-org/cli', 9876543)
ORDER BY duration_seconds DESC;
Link
jobs (project VARCHAR, include_retried := BOOLEAN, pipeline_id := BIGINT) 2 examples

CI/CD jobs of a GitLab project or one pipeline, newest first

Positional arguments
project VARCHAR
Project path 'group/name' or numeric id.
Named arguments
include_retried := BOOLEAN
For a pipeline, also list attempts that were retried. Β· default false
pipeline_id := BIGINT
Only the jobs of this pipeline (same as WHERE pipeline_id =). Β· default null
Returns columns
repo VARCHAR
Project path.
id BIGINT
Instance-wide job id β€” what job_log() takes.
name VARCHAR
Job name from .gitlab-ci.yml.
stage VARCHAR
Stage the job belongs to.
status VARCHAR
success, failed, running, pending, canceled, skipped, manual, ... Pushed down.
ref VARCHAR
Branch or tag.
is_tag BOOLEAN
Whether ref is a tag.
allow_failure BOOLEAN
Whether a failure of this job does not fail the pipeline.
pipeline_id BIGINT
The pipeline the job belongs to. Pushed down.
pipeline_status VARCHAR
Status of that pipeline.
commit_sha VARCHAR
Commit the job ran for.
user_login VARCHAR
Who triggered the job.
runner_id BIGINT
Runner that ran the job.
runner_description VARCHAR
That runner's description.
runner_tags VARCHAR[]
Runner tags the job requires.
failure_reason VARCHAR
Why it failed, e.g. 'script_failure', 'runner_system_failure'.
coverage DOUBLE
Coverage percentage parsed from the log.
is_archived BOOLEAN
Whether the job is archived (cannot be retried).
html_url VARCHAR
Link to the job in the GitLab UI.
created_at TIMESTAMP WITH TIME ZONE
When the job was created.
started_at TIMESTAMP WITH TIME ZONE
When a runner started it.
finished_at TIMESTAMP WITH TIME ZONE
When it finished.
erased_at TIMESTAMP WITH TIME ZONE
When its log and artifacts were erased.
duration_seconds DOUBLE
Running time in seconds.
queued_duration_seconds DOUBLE
Seconds spent waiting for a runner.
Examples (2)

Failed jobs of one pipeline

SELECT name, failure_reason, duration_seconds
FROM gitlab.main.jobs('gitlab-org/cli', pipeline_id := 1234567)
WHERE status = 'failed'
ORDER BY name;

Which jobs wait longest for a runner

SELECT name, count(*) AS runs, avg(queued_duration_seconds) AS avg_queue_s
FROM (SELECT * FROM gitlab.main.jobs('gitlab-org/gitlab-runner') LIMIT 500)
GROUP BY name
ORDER BY avg_queue_s DESC;
Link
members (namespace VARCHAR, inherited := BOOLEAN) 1 example

Members of a GitLab project or group with their access levels

Positional arguments
namespace VARCHAR
Project path ('group/name') or group path ('group').
Named arguments
inherited := BOOLEAN
Include members inherited from ancestor groups (/members/all). Β· default true
Returns columns
namespace VARCHAR
The project or group path the membership was listed for.
source VARCHAR
'project' or 'group': which kind of namespace the path resolved to.
id BIGINT
Numeric user id.
login VARCHAR
Username.
name VARCHAR
Display name.
state VARCHAR
'active', 'blocked', 'awaiting', ...
access_level INTEGER
10 guest, 15 planner, 20 reporter, 30 developer, 40 maintainer, 50 owner.
access_level_name VARCHAR
access_level as a word, e.g. 'developer'.
expires_at DATE
When the membership expires, if set.
created_at TIMESTAMP WITH TIME ZONE
When the membership was created.
html_url VARCHAR
Link to the user's profile.
Example

Maintainers and owners of a project

SELECT login, access_level_name
FROM gitlab.main.members('gitlab-org/gitlab-runner')
WHERE access_level >= 40
ORDER BY login;
Link
merge_request_approvals (project VARCHAR, number BIGINT) 1 example

Approval state of one GitLab merge request: who approved and how many are still needed

Arguments
project VARCHAR
Project path 'group/name' or id.
number BIGINT
The issue or merge request iid (the number column).
Returns columns
repo VARCHAR
Project path.
number BIGINT
Merge request iid.
is_approved BOOLEAN
Whether the merge request satisfies its approval rules.
approvals_required BIGINT
Approvals the rules require (Premium; 0 on Free).
approvals_left BIGINT
Approvals still missing.
approved_by VARCHAR[]
Usernames of everyone who approved.
user_has_approved BOOLEAN
Whether the token's user has approved.
Example

Merged merge requests that nobody approved

SELECT m.number, a.approved_by
FROM gitlab.main.merge_requests('gitlab-org/cli') m,
     LATERAL gitlab.main.merge_request_approvals(m.repo, m.number) a
WHERE m.gitlab_state = 'merged' AND len(a.approved_by) = 0;
Link
merge_request_diff_stats (project VARCHAR, number BIGINT) 1 example

Files changed by one GitLab merge request with added and removed line counts

Arguments
project VARCHAR
Project path 'group/name' or id.
number BIGINT
The issue or merge request iid (the number column).
Returns columns
repo VARCHAR
Project path.
number BIGINT
Merge request iid.
old_path VARCHAR
File path before the change.
new_path VARCHAR
File path after the change.
is_new_file BOOLEAN
Whether the file was added.
is_renamed_file BOOLEAN
Whether the file was renamed.
is_deleted_file BOOLEAN
Whether the file was deleted.
additions BIGINT
Lines added (counted from the diff hunk).
deletions BIGINT
Lines removed (counted from the diff hunk).
is_too_large BOOLEAN
GitLab omitted the diff text because it is too large (counts are NULL).
Example

Size of a merge request

SELECT count(*) AS files, sum(additions) AS added, sum(deletions) AS removed
FROM gitlab.main.merge_request_diff_stats('gitlab-org/cli', 1);
Link
merge_request_notes (project VARCHAR, number BIGINT) 1 example

Notes (review comments and system events) on one GitLab merge request, oldest first

Arguments
project VARCHAR
Project path 'group/name' or id.
number BIGINT
The issue or merge request iid (the number column).
Returns columns
repo VARCHAR
Project path the note belongs to.
number BIGINT
iid of the issue or merge request the note is on.
id BIGINT
GitLab's note id.
user_login VARCHAR
Username of the note's author.
body VARCHAR
Note text as Markdown (system notes describe events, e.g. 'added 1 commit').
is_system BOOLEAN
Whether GitLab generated the note (label changes, pushes, ...).
is_internal BOOLEAN
Whether the note is internal (visible to project members only).
is_resolvable BOOLEAN
Whether the note starts a resolvable thread.
is_resolved BOOLEAN
Whether its thread is resolved.
resolved_by_login VARCHAR
Who resolved the thread.
created_at TIMESTAMP WITH TIME ZONE
When the note was posted.
updated_at TIMESTAMP WITH TIME ZONE
When the note was last edited.
Example

Who commented on a merge request

SELECT user_login, count(*) AS comments
FROM gitlab.main.merge_request_notes('gitlab-org/cli', 1)
WHERE NOT is_system
GROUP BY user_login
ORDER BY comments DESC;
Link
merge_requests (project VARCHAR, labels := VARCHAR, search := VARCHAR) 2 examples

Merge requests of a GitLab project or group, with filters pushed to the API

Positional arguments
project VARCHAR
Project path 'group/name' (or id), or a group path for all its projects.
Named arguments
labels := VARCHAR
Comma-separated labels; a merge request must carry all of them. Β· default null
search := VARCHAR
Only merge requests whose title or description contains this. Β· default null
Returns columns
repo VARCHAR
Project path 'group/name' the merge request targets.
number BIGINT
Merge request iid within the project. Pushed down.
id BIGINT
GitLab's instance-wide merge request id.
title VARCHAR
Title.
state VARCHAR
'open' or 'closed' (GitHub vocabulary; merged counts as closed β€” test merged_at IS NOT NULL). Pushed down.
gitlab_state VARCHAR
GitLab's state: 'opened', 'closed', 'merged' or 'locked'. Pushed down.
is_draft BOOLEAN
Whether the merge request is a draft. Pushed down.
user_login VARCHAR
Username of the author. Pushed down.
head_ref VARCHAR
Source branch. Pushed down.
head_sha VARCHAR
Commit at the tip of the source branch.
base_ref VARCHAR
Target branch. Pushed down.
source_project_id BIGINT
Project the source branch lives in; differs for forks.
target_project_id BIGINT
Project the merge request targets.
labels VARCHAR[]
Labels applied; use the `labels` argument to push down.
assignees VARCHAR[]
Usernames of the assignees.
requested_reviewers VARCHAR[]
Usernames of the reviewers.
milestone VARCHAR
Milestone title. Pushed down.
merge_commit_sha VARCHAR
The merge commit (or squash commit) once merged.
merged_by_login VARCHAR
Username of whoever merged it.
comments BIGINT
Number of user (non-system) notes.
reactions_plus_one BIGINT
Thumbs-up (upvote) count.
has_conflicts BOOLEAN
Whether the merge request has merge conflicts.
detailed_merge_status VARCHAR
Mergeability, e.g. 'mergeable', 'ci_must_pass', 'conflict'.
is_squash BOOLEAN
Whether commits are squashed on merge.
body VARCHAR
Description as Markdown.
html_url VARCHAR
Link to the merge request in the GitLab UI.
created_at TIMESTAMP WITH TIME ZONE
When it was opened. Ranges are pushed down.
updated_at TIMESTAMP WITH TIME ZONE
When it last changed. Ranges are pushed down.
closed_at TIMESTAMP WITH TIME ZONE
When it was closed without merging; NULL otherwise.
merged_at TIMESTAMP WITH TIME ZONE
When it was merged; NULL if open or closed unmerged.
Examples (2)

How quickly merge requests get merged

SELECT count(*) AS merged,
  median(date_diff('hour', created_at, merged_at)) AS median_hours
FROM gitlab.main.merge_requests('gitlab-org/cli')
WHERE gitlab_state = 'merged' AND merged_at >= TIMESTAMPTZ '2026-10-01';

Open, ready-for-review merge requests into main

SELECT number, title, user_login
FROM gitlab.main.merge_requests('gitlab-org/gitlab-runner')
WHERE state = 'open' AND base_ref = 'main' AND NOT is_draft
ORDER BY updated_at DESC
LIMIT 10;
Link
pipelines (project VARCHAR) 2 examples

CI/CD pipelines of a GitLab project, newest first, with status/ref/source filters pushed down

Arguments
project VARCHAR
Project path 'group/name' or numeric id, e.g. 'gitlab-org/cli'.
Returns columns
repo VARCHAR
Project path.
id BIGINT
Instance-wide pipeline id β€” what jobs(pipeline_id := ...) takes.
iid BIGINT
Per-project pipeline number.
project_id BIGINT
Numeric project id.
status VARCHAR
GitLab status: success, failed, running, canceled, skipped, manual, ... Pushed down.
source VARCHAR
What triggered it: push, web, schedule, api, trigger, merge_request_event, pipeline, ... Pushed down.
ref VARCHAR
Branch or tag the pipeline ran for. Pushed down.
sha VARCHAR
Commit the pipeline ran for. Pushed down.
name VARCHAR
Pipeline name (workflow:name), if set. Detail column.
before_sha VARCHAR
Previous tip of the ref for push pipelines. Detail column.
is_tag BOOLEAN
Whether ref is a tag. Detail column.
user_login VARCHAR
Who triggered it. Pushed down (username). Detail column.
html_url VARCHAR
Link to the pipeline in the GitLab UI.
created_at TIMESTAMP WITH TIME ZONE
When the pipeline was created (queued).
updated_at TIMESTAMP WITH TIME ZONE
When the pipeline last changed. Ranges are pushed down.
started_at TIMESTAMP WITH TIME ZONE
When the first job started. Detail column.
finished_at TIMESTAMP WITH TIME ZONE
When the pipeline finished. Detail column.
committed_at TIMESTAMP WITH TIME ZONE
When the commit was committed. Detail column.
duration_seconds DOUBLE
Running time in seconds, excluding queueing. Detail column.
queued_duration_seconds DOUBLE
Seconds spent queued before starting. Detail column.
coverage DOUBLE
Test coverage percentage parsed from job logs. Detail column.
yaml_errors VARCHAR
CI configuration errors, when the pipeline could not be created. Detail.
Examples (2)

Failure counts per branch this month

SELECT ref, count(*) AS pipelines,
  count(*) FILTER (WHERE status = 'failed') AS failed
FROM gitlab.main.pipelines('gitlab-org/cli')
WHERE updated_at >= TIMESTAMPTZ '2026-11-01'
GROUP BY ref
ORDER BY failed DESC;

How long recent successful main pipelines took

SELECT id, duration_seconds, queued_duration_seconds
FROM gitlab.main.pipelines('gitlab-org/gitlab-runner')
WHERE status = 'success' AND ref = 'main'
ORDER BY id DESC
LIMIT 20;
Link
project (path VARCHAR) 2 examples

One GitLab project with its license and repository statistics

Arguments
path VARCHAR
Project path 'group/name' or numeric id, e.g. 'gitlab-org/gitlab'.
Returns columns
full_name VARCHAR
Project path 'group/subgroup/name' β€” the key every per-project function takes.
id BIGINT
GitLab's numeric project id; survives renames and transfers.
owner_login VARCHAR
Full path of the group or user namespace that owns the project.
owner_type VARCHAR
'group' or 'user'.
name VARCHAR
Project URL slug (the last path segment).
display_name VARCHAR
Project display name.
description VARCHAR
Project description.
html_url VARCHAR
Link to the project in the GitLab UI.
topics VARCHAR[]
Topics applied to the project.
visibility VARCHAR
'public', 'internal' or 'private'. Pushed down.
is_private BOOLEAN
Whether visibility is 'private'.
is_fork BOOLEAN
Whether the project is a fork.
forked_from VARCHAR
Path of the project this one was forked from.
is_archived BOOLEAN
Whether the project is archived (read-only). Pushed down.
default_branch VARCHAR
Default branch, e.g. 'main'.
stargazers_count BIGINT
Number of stars.
forks_count BIGINT
Number of forks.
open_issues_count BIGINT
Open issues (NULL when issues are disabled or hidden from you).
has_issues BOOLEAN
Whether the issue tracker is enabled.
has_wiki BOOLEAN
Whether the wiki is enabled.
has_merge_requests BOOLEAN
Whether merge requests are enabled.
is_empty_repo BOOLEAN
Whether the repository has no commits.
http_url_to_repo VARCHAR
HTTPS clone URL.
created_at TIMESTAMP WITH TIME ZONE
When the project was created.
updated_at TIMESTAMP WITH TIME ZONE
When the project object last changed.
last_activity_at TIMESTAMP WITH TIME ZONE
Last activity (push, issue, merge request, ...); the activity signal. Ranges are pushed down.
license_key VARCHAR
Detected license key, e.g. 'mit' or 'apache-2.0'.
license_name VARCHAR
Detected license name.
commit_count BIGINT
Commits on the default branch (needs Reporter access).
repository_size_bytes BIGINT
Repository size in bytes (needs Reporter access).
storage_size_bytes BIGINT
Total storage incl. LFS and artifacts (needs Reporter access).
Examples (2)

Stars, forks and license of one project

SELECT full_name, stargazers_count, forks_count, license_key
FROM gitlab.main.project('gitlab-org/gitlab-runner');

Compare projects side by side

SELECT p.full_name, p.stargazers_count
FROM (VALUES ('gitlab-org/gitlab'), ('gitlab-org/cli')) t(path),
     LATERAL gitlab.main.project(t.path) p
ORDER BY p.stargazers_count DESC;
Link
projects (namespace VARCHAR, include_subgroups := BOOLEAN, membership := BOOLEAN, search := VARCHAR) 2 examples

Projects in a GitLab group or user namespace, or the projects you are a member of

Positional arguments
namespace VARCHAR
Group path (e.g. 'gitlab-org') or username whose projects to list; NULL lists your memberships.
Named arguments
include_subgroups := BOOLEAN
For a group, also list projects in its subgroups. Β· default true
membership := BOOLEAN
Without a namespace: true lists projects you are a member of; false lists every project you can see (all of gitlab.com β€” combine with search or a LIMIT). Β· default true
search := VARCHAR
Only projects whose name or path contains this text. Β· default null
Returns columns
full_name VARCHAR
Project path 'group/subgroup/name' β€” the key every per-project function takes.
id BIGINT
GitLab's numeric project id; survives renames and transfers.
owner_login VARCHAR
Full path of the group or user namespace that owns the project.
owner_type VARCHAR
'group' or 'user'.
name VARCHAR
Project URL slug (the last path segment).
display_name VARCHAR
Project display name.
description VARCHAR
Project description.
html_url VARCHAR
Link to the project in the GitLab UI.
topics VARCHAR[]
Topics applied to the project.
visibility VARCHAR
'public', 'internal' or 'private'. Pushed down.
is_private BOOLEAN
Whether visibility is 'private'.
is_fork BOOLEAN
Whether the project is a fork.
forked_from VARCHAR
Path of the project this one was forked from.
is_archived BOOLEAN
Whether the project is archived (read-only). Pushed down.
default_branch VARCHAR
Default branch, e.g. 'main'.
stargazers_count BIGINT
Number of stars.
forks_count BIGINT
Number of forks.
open_issues_count BIGINT
Open issues (NULL when issues are disabled or hidden from you).
has_issues BOOLEAN
Whether the issue tracker is enabled.
has_wiki BOOLEAN
Whether the wiki is enabled.
has_merge_requests BOOLEAN
Whether merge requests are enabled.
is_empty_repo BOOLEAN
Whether the repository has no commits.
http_url_to_repo VARCHAR
HTTPS clone URL.
created_at TIMESTAMP WITH TIME ZONE
When the project was created.
updated_at TIMESTAMP WITH TIME ZONE
When the project object last changed.
last_activity_at TIMESTAMP WITH TIME ZONE
Last activity (push, issue, merge request, ...); the activity signal. Ranges are pushed down.
Examples (2)

The most-starred active projects of gitlab-org

SELECT full_name, stargazers_count, last_activity_at
FROM gitlab.main.projects('gitlab-org')
WHERE NOT is_archived AND last_activity_at >= TIMESTAMPTZ '2026-10-01'
ORDER BY stargazers_count DESC
LIMIT 10;

Your projects counted by visibility

SELECT visibility, count(*) AS projects
FROM gitlab.main.projects(NULL)
GROUP BY visibility
ORDER BY projects DESC;
Link
releases (project VARCHAR) 2 examples

Releases of a GitLab project, newest first

Arguments
project VARCHAR
Project path 'group/name' or numeric id, e.g. 'gitlab-org/cli'.
Returns columns
repo VARCHAR
Project path.
tag_name VARCHAR
Tag the release points at, e.g. 'v1.2.0'.
name VARCHAR
Release title.
is_upcoming BOOLEAN
Whether released_at is in the future (an upcoming release).
author_login VARCHAR
Username of the account that created the release.
commit_sha VARCHAR
The tagged commit.
assets_count BIGINT
Number of assets (links and source archives).
milestones VARCHAR[]
Titles of the milestones associated with the release.
body VARCHAR
Release notes as Markdown.
html_url VARCHAR
Link to the release in the GitLab UI.
created_at TIMESTAMP WITH TIME ZONE
When the release was created.
published_at TIMESTAMP WITH TIME ZONE
When the release is or was released (GitLab released_at).
Examples (2)

The ten latest releases

SELECT tag_name, published_at
FROM gitlab.main.releases('gitlab-org/cli')
WHERE NOT is_upcoming
ORDER BY published_at DESC
LIMIT 10;

Release cadence per quarter

SELECT date_trunc('quarter', published_at) AS quarter, count(*) AS releases
FROM gitlab.main.releases('gitlab-org/cli')
GROUP BY ALL
ORDER BY quarter;
Link
tags (project VARCHAR, search := VARCHAR) 1 example

Git tags of a GitLab project, newest first

Positional arguments
project VARCHAR
Project path 'group/name' or numeric id.
Named arguments
search := VARCHAR
Only names containing this text; '^x' means starts with, 'x$' ends with. Β· default null
Returns columns
repo VARCHAR
Project path.
name VARCHAR
Tag name, e.g. 'v1.2.0'. `name =` is pushed down.
message VARCHAR
Annotation message (annotated tags only).
target VARCHAR
Object the tag points at (the tag object for annotated tags).
commit_sha VARCHAR
The tagged commit.
commit_date TIMESTAMP WITH TIME ZONE
When the tagged commit was committed.
is_protected BOOLEAN
Whether the tag is protected.
has_release BOOLEAN
Whether a release is attached to the tag.
created_at TIMESTAMP WITH TIME ZONE
When an annotated tag was created (NULL for lightweight tags).
Example

v1 tags without a release

SELECT name, commit_date
FROM gitlab.main.tags('gitlab-org/cli', search := '^v1.')
WHERE NOT has_release
ORDER BY commit_date DESC;
Link
unified 2 tables Β· 1 function

GitLab pipelines and jobs in the cross-orchestrator runs / task_runs shape.

Schema examples (3)
Examples (3)

Pipeline outcomes of one project

SELECT status, count(*) AS runs
FROM gitlab.unified.runs
WHERE pipeline = 'gitlab-org/cli'
GROUP BY status
ORDER BY runs DESC;

Jobs of one pipeline

SELECT task_name, status, duration_seconds
FROM gitlab.unified.task_runs
WHERE run_id = 'gitlab-org/cli/1234567'
ORDER BY task_name;

Pipelines of a project by unified status

SELECT gitlab.unified.unified_status(status) AS status,
  count(*) AS pipelines
FROM gitlab.main.pipelines('gitlab-org/cli')
GROUP BY ALL
ORDER BY pipelines DESC;
Tables
runs 2 examples11 cols

One row per GitLab pipeline in the cross-orchestrator runs shape.

Columns
orchestratornot null VARCHAR
Always 'gitlab'.
run_idnot null VARCHAR
'<project path>/<pipeline id>'. `=` / IN is pushed down.
pipeline VARCHAR
Project path, e.g. 'gitlab-org/cli'. `=` / IN scopes the scan.
statusnot null VARCHAR
queued, running, success, failed, cancelled or skipped. Pushed down.
raw_status VARCHAR
GitLab's pipeline status, e.g. 'canceled' or 'manual'.
trigger VARCHAR
schedule, manual (web UI), api (API / trigger token), event (push, MR) or other.
queued_at TIMESTAMP WITH TIME ZONE
When the pipeline was created.
started_at TIMESTAMP WITH TIME ZONE
When its first job started.
ended_at TIMESTAMP WITH TIME ZONE
When it finished.
duration_seconds DOUBLE
GitLab's running time, else ended_at - started_at, in seconds.
url VARCHAR
Link to the pipeline in the GitLab UI.
ConstraintsPRIMARY KEY (run_id)
Examples (2)

Pipeline outcomes of one project

SELECT status, count(*) AS runs
FROM gitlab.unified.runs
WHERE pipeline = 'gitlab-org/cli'
GROUP BY status
ORDER BY runs DESC;

Median run time per project for successful runs since November

SELECT pipeline, median(duration_seconds) AS median_s
FROM gitlab.unified.runs
WHERE pipeline IN ('gitlab-org/cli', 'gitlab-org/gitlab-runner') AND status = 'success' AND started_at >= TIMESTAMPTZ '2026-11-01'
GROUP BY pipeline
ORDER BY pipeline;
Link
task_runs 1 example11 cols

One row per GitLab CI job in the cross-orchestrator task_runs shape.

Columns
orchestratornot null VARCHAR
Always 'gitlab'.
run_idnot null VARCHAR
'<project path>/<pipeline id>'; joins unified.runs.run_id. Pushed down.
task_run_idnot null VARCHAR
'<project path>/<pipeline id>/<job id>'. Pushed down.
task_name VARCHAR
Job name.
statusnot null VARCHAR
queued, running, success, failed, cancelled or skipped. Pushed down.
raw_status VARCHAR
GitLab's job status.
attempt INTEGER
Always NULL: GitLab does not number retries (each retry is its own job).
started_at TIMESTAMP WITH TIME ZONE
When a runner started the job.
ended_at TIMESTAMP WITH TIME ZONE
When the job finished.
duration_seconds DOUBLE
Running time in seconds.
url VARCHAR
Link to the job in the GitLab UI.
ConstraintsPRIMARY KEY (task_run_id) Β· FOREIGN KEY (run_id) REFERENCES runs(run_id)
Example

Jobs of one pipeline

SELECT task_name, status, duration_seconds
FROM gitlab.unified.task_runs
WHERE run_id = 'gitlab-org/cli/1234567'
ORDER BY task_name;
Link
Scalar functions
unified_status (raw_status VARCHAR, kind VARCHAR) +1 overload 4 examples

Map a GitLab pipeline status onto queued/running/success/failed/cancelled/skipped

Arguments
raw_status VARCHAR
A GitLab pipeline or job status, e.g. 'canceled' or 'manual'; NULL in, NULL out.
kind VARCHAR
Which mapping to use: pipeline statuses or job statuses (they differ only for 'manual').
Overloads
unified_status(raw_status VARCHAR) β†’ VARCHARunified_status(raw_status VARCHAR, kind VARCHAR) β†’ VARCHAR
ReturnsVARCHAR
Examples (4)

Pipelines of a project by unified status

SELECT gitlab.unified.unified_status(status) AS status,
  count(*) AS pipelines
FROM gitlab.main.pipelines('gitlab-org/cli')
GROUP BY ALL
ORDER BY pipelines DESC;

Recent jobs with unified statuses

SELECT name, gitlab.unified.unified_status(status, 'job') AS status
FROM gitlab.main.jobs('gitlab-org/gitlab-runner')
ORDER BY id DESC
LIMIT 20;
SELECT s AS raw_status, gitlab.unified.unified_status(s) AS status
FROM (VALUES ('canceled'), ('failed'), ('manual'), ('pending'), ('success')) t(s)
ORDER BY s;
1 more example
SELECT gitlab.unified.unified_status('manual', 'job') AS status;
Link

Credentials

The secret type gitlab declares, as reported by the worker itself.

gitlab

How to get these credentials

Access to one GitLab instance's REST API v4: an access token and, for self-managed GitLab, the instance's base URL (default https://gitlab.com).

secret.sql
CREATE SECRET gitlab (
    TYPE gitlab,
    token    '<GITLAB_TOKEN>',  -- secret
    base_url '<base_url>',
    send_as  '<send_as>',
    per_page '<per_page>',
    timeout  '<timeout>'
);
Key Type Required Description
token secret VARCHAR β€” Personal, project or group access token (read_api scope is enough), or an OAuth access token. Optional for public projects on gitlab.com.
base_url VARCHAR β€” Root URL of the GitLab instance without /api/v4, e.g. 'https://gitlab.example.com'. Default 'https://gitlab.com'.
send_as VARCHAR β€” How the token is sent: 'bearer' (default; Authorization: Bearer), 'private' (PRIVATE-TOKEN header) or 'job' (JOB-TOKEN header, for CI job tokens).
per_page BIGINT β€” Items requested per API page, 1 to 100 (default 100).
timeout DOUBLE β€” Per-request timeout in seconds (default 30).

The worker doesn't mark which keys are required.

Needed by groupsprojectsprojectmembersissuesissue_notesmerge_requestsmerge_request_notesmerge_request_approvalsmerge_request_diff_statscommitsbranches and 9 more functions

Create the secret in the same session, after attaching gitlab β€” the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

The most-starred active projects of gitlab-org

SELECT full_name, stargazers_count, last_activity_at
FROM gitlab.main.projects('gitlab-org')
WHERE NOT is_archived AND last_activity_at >= TIMESTAMPTZ '2026-10-01'
ORDER BY stargazers_count DESC
LIMIT 10

Uses projects

Stars, forks and license of one project

SELECT full_name, stargazers_count, forks_count, license_key
FROM gitlab.main.project('gitlab-org/gitlab-runner')

Uses project

Maintainers and owners of a project

SELECT login, access_level_name
FROM gitlab.main.members('gitlab-org/gitlab-runner')
WHERE access_level >= 40
ORDER BY login

Uses members

The newest open bugs of a project

SELECT number, title, user_login, created_at
FROM gitlab.main.issues('gitlab-org/gitlab-runner', labels := 'bug')
WHERE state = 'open'
ORDER BY created_at DESC
LIMIT 20

Uses issues

The human comments on an issue

SELECT user_login, created_at, body
FROM gitlab.main.issue_notes('gitlab-org/cli', 1)
WHERE NOT is_system
ORDER BY created_at

Uses issue_notes

How quickly merge requests get merged

SELECT count(*) AS merged,
  median(date_diff('hour', created_at, merged_at)) AS median_hours
FROM gitlab.main.merge_requests('gitlab-org/cli')
WHERE gitlab_state = 'merged' AND merged_at >= TIMESTAMPTZ '2026-10-01'

Uses merge_requests

31 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Using the gitlab worker, list the numbers and titles of the open issues labelled 'bug' in the project acme/widgets.
  • How many merge requests in acme/widgets have been merged, and what is the median number of hours from opening to merge?
  • Which pipelines of acme/widgets failed? Give their ids and refs.
  • Show the log lines of job 9003 in acme/widgets that mention 'ERROR'.
  • Count the CI runs of the project acme/widgets per unified status (queued, running, success, failed, cancelled, skipped).
  • List the subgroups of the acme group, and the non-archived projects in acme with their star counts.

GitLab is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.