Repository navigation
Releases
v0.3.1
Full Changelog: v0.3.0...v0.3.1
v0.3.0
Speaks VGI protocol 3.3 (vgi-python 0.51.0) and requires the current VGI DuckDB extension; 3.2 extensions are incompatible. The github secret type now documents its token parameter and links to how to create one.
v0.2.0
vgi-github now speaks VGI protocol 3.2 (vgi-python 0.50.0, vgi-rpc 0.53.1). This release also adds typed Discussions and Projects tables, a generated rest schema covering every GitHub GET operation, and query-only GraphQL.
INSTALL vgi FROM community;
LOAD vgi;
ATTACH 'github' (TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-github@v0.2.0 vgi-github');
CREATE SECRET github (TYPE github, token 'ghp_...'); -- optionalNew
- Discussions and Projects: typed
main.discussions,discussion_commentsanddiscussion_repliescome through GraphQL, andprojects,project_itemsandproject_fieldsthrough REST. They paginate automatically within bounds, take named filters and work inside correlatedLATERALjoins. Custom Project field values stay JSON. - Complete REST reads: a generated
restschema has all 780 distinct GET operations from the pinned GitHub.com and Enterprise Cloud API descriptions.api.endpointslists them andapi.rest()calls any of them. Complete JSON, HTTP statuses, binary downloads and pagination links come through intact. - GraphQL:
api.graphql()runs queries only. The worker parses every document before sending it and rejects mutations, subscriptions and schema definitions. cache_ttlATTACH option: sets a default result TTL for lookups and searches. A per-call TTL overrides it.token_sourceATTACH option:'gh'uses the GitHub CLI's login and'env'usesGH_TOKEN/GITHUB_TOKEN. An HTTP or socket server refuses it unless started withVGI_GITHUB_ALLOW_TOKEN_SOURCE=1.- Logging: rate-limit waits, retries, a low-budget warning and a one-line summary per call go to DuckDB's log (
duckdb_logs_parsed('VGI')). catalog_contentsloads the whole catalog in one RPC.
Fixes and maintenance
- Protocol 3.1 and then 3.2 support, through VGI SDK upgrades.
- GraphQL errors are reported before partial response data, so a large response can't hide the cause.
- Catalog metadata meets vgi-lint 2.2: the title is now
GitHub APIand there is a one-sentencevgi.subtitle. CI now lints with vgi-lint-check 2.2.0 and fails on info-level findings. - Agent-task grading data moved to
vgi-agent-tests.yaml. - A weekly read-only workflow checks upstream REST coverage for drift.
See CHANGELOG.md for the full list.
v0.1.0
GitHub as DuckDB tables: repositories, issues, pull requests, commits, releases, contributors and Actions runs, all read-only, and every per-repository function works inside a LATERAL join.
INSTALL vgi FROM community;
LOAD vgi;
ATTACH 'github' (TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-github@v0.1.0 vgi-github');
CREATE SECRET github (TYPE github, token 'ghp_...'); -- optional, see belowSearch, then fan out
The search functions take GitHub's own query syntax and stream results, so they make a good starting point. Each row's full_name then feeds any per-repository function:
-- Open issues across an organization's five most-starred repositories
SELECT r.full_name, count(i.number) AS open_issues
FROM (SELECT full_name FROM github.search_repositories('org:duckdb', sort => 'stars') LIMIT 5) r,
LATERAL github.issues(r.full_name, state => 'open') i
GROUP BY r.full_name
ORDER BY open_issues DESC;
-- Where a project's top contributors say they work
SELECT c.login, c.contributions, u.company, u.location
FROM github.contributors('duckdb/duckdb', max_rows => 10) c,
LATERAL github.user(c.login, cache_ttl => 3600) u
ORDER BY c.contributions DESC;
-- CI failure rate per workflow
SELECT name, count(*) FILTER (WHERE conclusion = 'failure') / count(*) AS failure_rate
FROM github.workflow_runs('duckdb/duckdb', status => 'completed')
GROUP BY name ORDER BY failure_rate DESC;List functions return up to max_rows rows per input row (100 by default, which is one request). Filter with their arguments, like state =>, since => and branch =>, rather than WHERE, because a WHERE only sees the rows that were already fetched.
Authentication
Without a token GitHub allows 60 requests an hour; with one, 5,000, and private repositories become visible. Use a DuckDB secret of type github; it can have any name. Attach with auth 'required' if a missing token should be an error rather than a quiet fall back to anonymous access.
Serving over HTTP
Run one long-lived server instead of a worker per connection:
uvx --from git+https://github.com/Query-farm/vgi-github@v0.1.0 vgi-github-http --port 8000ATTACH 'github' (TYPE vgi, LOCATION 'http://localhost:8000');
CREATE SECRET github (TYPE github, token 'ghp_...');Each client sends its own token, and one client's token never authorizes another's queries. The server doesn't authenticate clients itself, though, so keep it on localhost or put it behind a proxy, and don't set VGI_GITHUB_TOKEN on a shared server unless you mean every client to use that token. The README covers --host, --prefix and the other options.
Known issues
- On macOS, DuckDB 1.5's
duckdb_functions()can show named arguments with each other's types. Queries are unaffected, andvgi_function_arguments()reports them correctly. A fix is proposed upstream in duckdb/duckdb#26409. stargazers()only works for repositories your token administers, because GitHub refuses the listing for anyone else's.repo()still gives youstargazers_count.