{"id":48414582,"url":"https://github.com/benaiad/sqlize","last_synced_at":"2026-04-06T07:01:35.912Z","repository":{"id":346470983,"uuid":"1188477388","full_name":"Benaiad/sqlize","owner":"Benaiad","description":"SQL interface for REST APIs","archived":false,"fork":false,"pushed_at":"2026-04-03T18:17:03.000Z","size":3873,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T20:55:05.590Z","etag":null,"topics":["cli","developer-tools","mcp","openapi","rest-api","rust","sql"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Benaiad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-22T06:01:24.000Z","updated_at":"2026-04-03T18:17:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Benaiad/sqlize","commit_stats":null,"previous_names":["benaiad/sqlize"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Benaiad/sqlize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benaiad%2Fsqlize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benaiad%2Fsqlize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benaiad%2Fsqlize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benaiad%2Fsqlize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Benaiad","download_url":"https://codeload.github.com/Benaiad/sqlize/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benaiad%2Fsqlize/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31463015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","developer-tools","mcp","openapi","rest-api","rust","sql"],"created_at":"2026-04-06T07:01:06.738Z","updated_at":"2026-04-06T07:01:35.906Z","avatar_url":"https://github.com/Benaiad.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlize\n\nAn SQL layer for REST API endpoints.\n\nQuery GitHub issues, Stripe customers, GitLab pipelines — any REST API that has an OpenAPI spec — using plain SQL. Pagination, auth, filter pushdown, and cross-API JOINs are handled automatically.\n\n![sqlize demo](vhs-demo/demo.gif)\n\n```sql\nSELECT number, title, state\nFROM issues\nWHERE owner = 'rust-lang' AND repo = 'rust' AND state = 'open'\nLIMIT 5;\n```\n\n```\n[5]{number,title,state}:\n  154162,\"(EXPERIMENT) Replace zero-deps nodes with a singleton\",open\n  154161,On E0277 tweak help when single type impls traits,open\n  154160,Rollup of 6 pull requests,open\n  154158,\"Audit `//@ run-pass` directives in UI tests\",open\n  154157,Enforce deterministic signed zero behavior in float min/max and clamp,open\n```\n\n## Why SQL\n\nREST APIs are imperative — you need to know the endpoint, the parameters, the pagination scheme, the response shape. SQL is declarative — you say what you want and the engine figures out how to get it.\n\nThe mapping is natural: endpoints become tables, parameters become columns, and the query planner translates SQL into API calls. `WHERE owner = 'rust-lang'` becomes a path parameter in the URL. `WHERE state = 'open'` becomes `?state=open` in the query string. `ORDER BY`, `GROUP BY`, `LIMIT` are applied locally by the engine after fetching.\n\nPowered by [Apache DataFusion](https://datafusion.apache.org/). Supports `SELECT`, `WHERE`, `ORDER BY`, `LIMIT`, `OFFSET`, `GROUP BY`, `HAVING`, `COUNT`, `SUM`, `AVG`, `MIN`, `MAX`, `JOIN`, subqueries, CTEs, `UNION`/`INTERSECT`, `CASE`, `CAST`, and more. Read-only.\n\n## Quickstart\n\n```sh\n# macOS / Linux\ncurl --proto '=https' --tlsv1.2 -LsSf https://github.com/Benaiad/sqlize/releases/latest/download/sqlize-installer.sh | sh\n\n# Windows\npowershell -ExecutionPolicy Bypass -c \"irm https://github.com/Benaiad/sqlize/releases/latest/download/sqlize-installer.ps1 | iex\"\n\n# Or with Cargo\ncargo install sqlize\n```\n\n### Query GitHub\n\n```sh\nexport GITHUB_TOKEN=ghp_...\nexport SQLIZE_BEARER_ENV_VAR=GITHUB_TOKEN\nsqlize --spec specs/github-minimal.json\n```\n\n```sql\nsqlize\u003e SHOW TABLES;\nsqlize\u003e DESCRIBE issues;\nsqlize\u003e SELECT number, title FROM issues WHERE owner = 'rust-lang' AND repo = 'rust' LIMIT 5;\n```\n\n### Query Stripe\n\n```sh\nexport STRIPE_API_KEY=sk_test_...\nexport SQLIZE_BEARER_ENV_VAR=STRIPE_API_KEY\nsqlize --spec specs/stripe-minimal.json\n```\n\n```sql\nsqlize\u003e SELECT email, name FROM customers;\n```\n\n### Query GitLab\n\n```sh\nexport GITLAB_TOKEN=glpat-...\nexport SQLIZE_BEARER_ENV_VAR=GITLAB_TOKEN\nsqlize --spec specs/gitlab-minimal.json\n```\n\n```sql\nsqlize\u003e SELECT title, state FROM issues WHERE id = '12345' LIMIT 5;\n```\n\nCurated minimal specs ship with the repo:\n\n| Spec | Tables | Notes |\n|------|--------|-------|\n| `specs/github-minimal.json` | 9 | Issues, PRs, commits, releases, repos |\n| `specs/gitlab-minimal.json` | 5 | Projects, issues, MRs, pipelines, members |\n| `specs/stripe-minimal.json` | 5 | Customers, charges, subscriptions, invoices, products |\n\nAny REST API with an OpenAPI spec works — these are just the ones we've tested.\n\n## Cross-API JOINs\n\nQuery multiple APIs in a single session:\n\n```sh\nsqlize \\\n  --spec github:specs/github-minimal.json \\\n  --spec stripe:specs/stripe-minimal.json\n```\n\n```sql\nSELECT c.name, c.email, k.commit_message\nFROM stripe.customers c\nJOIN github.commits k ON c.name = k.author_login\nWHERE k.owner = 'openclaw' AND k.repo = 'openclaw'\nLIMIT 5;\n```\n\nEach spec registers a named schema. Use qualified names (`github.issues`, `stripe.customers`) to query across APIs.\n\n### Per-spec auth\n\nEach spec resolves its token independently:\n\n```sh\nexport SQLIZE_BEARER_ENV_VAR_GITHUB=GITHUB_TOKEN\nexport SQLIZE_BEARER_ENV_VAR_STRIPE=STRIPE_API_KEY\n```\n\nFalls back to `SQLIZE_BEARER_TOKEN` / `SQLIZE_BEARER_ENV_VAR` when no per-spec var is set.\n\n## MCP server\n\nsqlize runs as an MCP server, giving AI agents SQL access to REST APIs through three tools:\n\n- **`get_schema`** — `CREATE TABLE` DDL for table discovery\n- **`query`** — executes SQL, returns results in TOON\n- **`explain`** — shows the execution plan without running it\n\nThree tools. Not 25 per service. Adding more APIs adds tables, not tools — the context window cost stays flat.\n\n```sh\nclaude mcp add \\\n  --transport stdio \\\n  --env SQLIZE_SPEC_PATH=/path/to/specs/github-minimal.json \\\n  --env SQLIZE_BEARER_ENV_VAR=GITHUB_TOKEN \\\n  --scope user \\\n  sqlize-github -- sqlize mcp\n```\n\nResults are returned in [TOON](https://github.com/toon-format/toon) format by default — 40-50% smaller than JSON, designed for LLM consumption.\n\n## CLI reference\n\nSingle-shot commands for scripts and automation:\n\n```sh\nsqlize --spec specs/github-minimal.json query \"SELECT number, title FROM issues WHERE owner = 'rust-lang' AND repo = 'rust' LIMIT 5\"\nsqlize --spec specs/github-minimal.json explain \"SELECT ...\"\nsqlize --spec specs/github-minimal.json schema issues\n```\n\nOutput is JSON by default, `--format toon` for compact output, `--format table` for human-readable tables.\n\n## How queries map to API calls\n\n```sql\nEXPLAIN SELECT number, title FROM issues\nWHERE owner = 'openclaw' AND repo = 'openclaw' AND state = 'open'\nORDER BY created_at DESC\nLIMIT 10;\n```\n\n- `owner`, `repo` — path parameters, substituted into the URL\n- `state` — query parameter, pushed to the API as `?state=open`\n- `ORDER BY`, `LIMIT` — applied locally by DataFusion after the fetch\n\nPath parameters are required — omitting them fails at query planning, before any HTTP call is made.\n\n## Pagination\n\nsqlize paginates automatically using the standard `Link` header (`rel=\"next\"`) or common response body fields (`next`, `next_url`). Works with GitHub, GitLab, Stripe, and most REST APIs without configuration.\n\nEach table scan fetches pages lazily until one of these limits is reached:\n\n- **SQL `LIMIT`** — only the needed pages are fetched\n- **`max_rows`** (default 1000) — caps total rows per table scan when no SQL `LIMIT` applies\n\nOverride the default:\n\n```sh\nsqlize --spec specs/github.json --max-rows 5000\n# or\nexport SQLIZE_MAX_ROWS=5000\n```\n\n## Bring your own API\n\nsqlize works with any REST API that has an OpenAPI 3.x spec. For large specs, use `--tags` to filter endpoints:\n\n```sh\ncurl -L -o specs/github.json \\\n  https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json\n\nsqlize --spec specs/github.json --tags repos,issues\n```\n\n## Status\n\nEarly development — APIs may change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenaiad%2Fsqlize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenaiad%2Fsqlize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenaiad%2Fsqlize/lists"}