# GitHub

> GitHub repositories, issues, pull requests, commits, releases, contributors and Actions runs

This page includes setup, release pins, credentials, hosting and verification evidence. [JSON alternative](https://query.farm/products/orchard/api/v1/connectors/github.json) contains the same setup facts for structured readers; choose one format.

## Runtime and release

Use DuckDB or Haybarn **2.0.1** with **VGI protocol 3.4**.
Catalog alias: `github`. Release: [v0.4.1](https://github.com/Query-farm/vgi-github/releases/tag/v0.4.1). Metadata generated: 2026-12-01T18:22:16+00:00.

## Choose where it runs

- On your machine: use an installation method below. No Query Farm account is required for local execution.
- Self-host: follow [the connector deployment instructions](https://github.com/Query-farm/vgi-github) and [connection guide](https://query.farm/vgi/connect-to-a-worker/). Use your real endpoint and its authentication settings.
- Query Farm hosted: [create a deployment](https://auth.queryfarm.cloud/console/new?worker=github). Hosting has a $10 monthly minimum per organization; usage and license fees may apply. Copy the deployment-specific ATTACH from the console.

## Service credentials and prerequisites

Public repository REST reads work anonymously (60 requests an hour); a token raises the limit and reaches private repositories. GraphQL operations, including Discussions, require a token even for public data.

Secret parameter required flags describe the upstream declaration; they do not override the service-level mode above. Keep secrets in environment variables or the deployment secret store. SQL values in angle brackets are placeholders, not automatic environment lookups. Native DuckDB and Haybarn 2.0.1 do not provide a SQL getenv() function, even when worker-supplied snippets mention it. Read environment variables in your application and pass credential values through client parameter bindings (for example, Python con.execute("CREATE SECRET stripe (TYPE stripe, api_key ?)", [os.environ["STRIPE_API_KEY"]]) after attaching the connector. Omit unused optional parameters and keep real values out of saved SQL and logs.

After installing VGI and attaching the connector, create the required secrets using your own values. Replace placeholders and omit unused optional parameters from the templates below.

### github

GitHub API token for authenticated access. Optional, but anonymous access is limited to 60 requests an hour and cannot see private repositories. Provide token (a personal access token, OAuth token such as `gh auth token` prints, or an App installation token).
[Credential instructions](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)

```json
[
  {
    "name": "token",
    "type": "VARCHAR",
    "required": false,
    "redact": true,
    "description": "Personal access token from GitHub Settings > Developer settings > Personal access tokens, or the output of `gh auth token`"
  }
]
```

```sql
CREATE SECRET github (
    TYPE github,
    token '<GITHUB_TOKEN>'  -- secret
);
```

ATTACH options (exact declarations; omitted defaults are unknown):

```json
[
  {
    "name": "reporting",
    "type": "BOOLEAN",
    "description": "Reporting: complete validated keyed listings with max_rows=0; no result caching.",
    "required": false,
    "default": "false"
  },
  {
    "name": "operation_timeout_seconds",
    "type": "BIGINT",
    "description": "Reporting operation deadline across a blended input batch, in seconds (1..3600).",
    "required": false,
    "default": "120"
  },
  {
    "name": "cache_ttl",
    "type": "BIGINT",
    "description": "Default result cache seconds; 0 uses GitHub policy. Per-call cache_ttl overrides this.",
    "required": false,
    "default": "0"
  },
  {
    "name": "auth",
    "type": "VARCHAR",
    "description": "How to treat the optional 'github' secret: 'auto' (default) authenticates when one is present and goes anonymous otherwise; 'required' fails the query when none resolves; 'off' never authenticates.",
    "required": false,
    "default": "auto"
  },
  {
    "name": "token_source",
    "type": "VARCHAR",
    "description": "Where to find your GitHub identity when no 'github' secret resolves: 'gh' uses the GitHub CLI's login (gh auth token), 'env' uses GH_TOKEN or GITHUB_TOKEN. Only when DuckDB launches the worker locally; refused by a shared HTTP server.",
    "required": false,
    "default": ""
  }
]
```

## Install the extension

In stock DuckDB:

```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;
```

In Haybarn:

```sql
INSTALL vgi FROM community;
LOAD vgi;
```

## Attach the connector

The local recipes below pin the catalog release for repeatability. A public demo endpoint follows its deployed release.

### uvx

Attach with uvx

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

```sql
ATTACH 'github' AS github (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-github@v0.4.1 vgi-github'
);
```

### Docker

Attach the signed image

Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.

```sql
ATTACH 'github' AS github (
  TYPE vgi,
  LOCATION 'oci://ghcr.io/query-farm/vgi-github:0.4.1'
);
```

## Find the most-requested open DuckDB issues

Service credentials required for this example: not declared by this example; check the connector requirements above.

```sql
SELECT number, title, reactions_plus_one FROM github.main.search_issues('repo:duckdb/duckdb is:issue is:open', sort => 'reactions-+1') LIMIT 10
```

- [github.main.search_issues — table_function](https://query.farm/products/orchard/connectors/github/objects/table_function.bWFpbg.c2VhcmNoX2lzc3Vlcw.md): exact declaration for this example.

Execution evidence: **captured_result**.

```json
{
  "status": "captured_result",
  "capturedAt": "2026-12-01T06:16:30+00:00",
  "engineVersion": "2.0.1",
  "protocolVersion": "3.4.0",
  "releaseTag": "v0.4.1",
  "sample": {
    "columns": [
      "number",
      "title",
      "reactions_plus_one"
    ],
    "types": [
      "BIGINT",
      "VARCHAR",
      "BIGINT"
    ],
    "rows": [
      [
        3152,
        "[Feature Request] Context Managers in Python API",
        26
      ],
      [
        13217,
        "Query with hive partitioning much slower than hardcoded path",
        22
      ],
      [
        1768,
        "Add support for SERIAL and BIGSERIAL type",
        20
      ],
      [
        57,
        "ALTER TABLE support for adding foreign key constraints",
        15
      ],
      [
        11779,
        "DuckDB does not follow XDG Base Directory Spec",
        14
      ]
    ],
    "more": true
  }
}
```

## Connector reference

GitHub's REST and GraphQL APIs, read-only, as SQL.

Use `main` for curated typed tables, `rest` for all pinned REST GET operations, and `api` for endpoint discovery and GraphQL queries. REST pages retain complete JSON and binary bodies. GraphQL mutation documents are rejected before transport.

### Key concepts

- **A repository is written `'owner/name'`.** That one string is the key for everything repository-scoped, and every row that belongs to a repository carries it in a `repo` or `full_name` column — so the output of one function is the input of the next.
- **Search starts a question; lookups answer it.** The search functions take GitHub's own query syntax and stream results, so they drive a query. The keyed functions take a repository or a login and are built to sit inside a correlated `LATERAL`.
- **List functions are capped.** A function under `LATERAL` has to fetch everything for its input before it returns, so the keyed list functions take `max_rows`, default 100 — one page per input row. Discussion lists default to recently updated first; comments, replies and Projects retain GitHub's connection/listing order. `max_rows => 0` fetches everything, up to 10,000 rows per input row. The two search functions stream instead, take no `max_rows`, and stop at GitHub's 1,000-result cap.
- **Filter with arguments.** DuckDB applies a WHERE clause after the rows are fetched, so it cannot reach past `max_rows`. Named arguments such as `state =>` and `since =>` are sent to GitHub and narrow before the cap.

### A typical shape

A search drives, and a keyed function fans out from each row it returns:

```sql
FROM github.main.search_repositories('org:duckdb') r,
     LATERAL github.main.issues(r.full_name, state => 'open') i
```

### Authentication and rate limits

A token raises the budget from 60 requests an hour to 5,000 and makes private repositories visible. Without one, a private repository is indistinguishable from a missing one: both return no rows. Supply it as a DuckDB secret of type `github`; the `rate_limit` table shows what remains and whether a token is in use.

## Find the exact SQL object

[Browse 845 object declarations](https://query.farm/products/orchard/api/v1/connectors/github/objects.json) or [search within this connector](https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=github&q=github).

Follow one format of each needed object for complete argument types, defaults, named flags, return columns and examples. Existing links above can replace another search. For questions about hosting, credentials or supported operations, stop once the documentation answers the question; SQL and unrelated object lookups are unnecessary.

## Verification and interpretation

- Missing, null, or undeclared metadata means unknown; do not invent defaults, credential scope, platform support or endpoint URLs.
- Search is keyword retrieval, not proof of a capability. Read the exact object declaration before generating SQL.
- A table and a table function can have the same name. Preserve parentheses and use the matching overload and schema.
- Service credentials, external data availability and deployment authentication are separate requirements.
- Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL.

```json
{
  "generatedAt": "2026-12-01T18:22:16+00:00",
  "repository": "https://github.com/Query-farm/vgi-github",
  "harvest": {
    "status": "ok",
    "method": "subprocess",
    "error": null,
    "vgi_version": "9773130dde"
  },
  "catalogVerification": {
    "verified": true,
    "status": "passed_with_credential_skips",
    "total": 8,
    "passed": 4,
    "failed": 0,
    "needs_credentials": 4,
    "location": "uvx --from git+https://github.com/Query-farm/vgi-github@v0.4.1 vgi-github",
    "transport": "subprocess",
    "environment": {
      "vgi_extension_version": "9773130dde",
      "haybarn_version": "2.0.1rc3",
      "engine_version": "v2.0.1",
      "python": "3.12.4",
      "platform": "darwin_arm64",
      "protocol_version": "3.4.0"
    },
    "checked_at": "2026-12-01T06:13:01+00:00"
  },
  "interpretation": "Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL."
}
```
