{"id":44574587,"url":"https://github.com/mickamy/sql-tap","last_synced_at":"2026-02-20T04:00:44.644Z","repository":{"id":338353808,"uuid":"1157577714","full_name":"mickamy/sql-tap","owner":"mickamy","description":"Watch SQL traffic in real-time with a TUI","archived":false,"fork":false,"pushed_at":"2026-02-19T06:07:19.000Z","size":2805,"stargazers_count":901,"open_issues_count":0,"forks_count":21,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-02-19T06:56:22.982Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/mickamy.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-02-14T01:41:59.000Z","updated_at":"2026-02-19T06:07:22.000Z","dependencies_parsed_at":"2026-02-14T09:02:00.734Z","dependency_job_id":null,"html_url":"https://github.com/mickamy/sql-tap","commit_stats":null,"previous_names":["mickamy/sql-tap"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/mickamy/sql-tap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fsql-tap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fsql-tap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fsql-tap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fsql-tap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mickamy","download_url":"https://codeload.github.com/mickamy/sql-tap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fsql-tap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29640861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T03:21:14.183Z","status":"ssl_error","status_checked_at":"2026-02-20T03:18:24.455Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-14T04:12:46.545Z","updated_at":"2026-02-20T04:00:44.598Z","avatar_url":"https://github.com/mickamy.png","language":"Go","funding_links":["https://github.com/sponsors/mickamy"],"categories":["Analysis","Go"],"sub_categories":[],"readme":"# sql-tap\n\n[![Sponsor](https://img.shields.io/badge/Sponsor-❤-ea4aaa?style=flat-square\u0026logo=github)](https://github.com/sponsors/mickamy)\n\nReal-time SQL traffic viewer — proxy daemon + TUI client.\n\nsql-tap sits between your application and your database (PostgreSQL, MySQL, or TiDB), capturing every query and\ndisplaying it in an interactive terminal UI. Inspect queries, view transactions, and run EXPLAIN — all without changing\nyour application code.\n\n![demo](./docs/demo.gif)\n\n## Installation\n\n### Homebrew\n\n```bash\nbrew install --cask mickamy/tap/sql-tap\n```\n\n### Go\n\n```bash\ngo install github.com/mickamy/sql-tap@latest\ngo install github.com/mickamy/sql-tap/cmd/sql-tapd@latest\n```\n\n### Build from source\n\n```bash\ngit clone https://github.com/mickamy/sql-tap.git\ncd sql-tap\nmake install\n```\n\n### Docker\n\n**PostgreSQL**\n\n```dockerfile\nFROM postgres:18-alpine\nARG SQL_TAP_VERSION=0.0.1\nARG TARGETARCH\nADD https://github.com/mickamy/sql-tap/releases/download/v${SQL_TAP_VERSION}/sql-tap_${SQL_TAP_VERSION}_linux_${TARGETARCH}.tar.gz /tmp/sql-tap.tar.gz\nRUN tar -xzf /tmp/sql-tap.tar.gz -C /usr/local/bin sql-tapd \u0026\u0026 rm /tmp/sql-tap.tar.gz\nENTRYPOINT [\"sql-tapd\", \"--driver=postgres\", \"--listen=:5433\", \"--upstream=localhost:5432\", \"--grpc=:9091\"]\n```\n\n**MySQL**\n\n```dockerfile\nFROM mysql:8\nARG SQL_TAP_VERSION=0.0.1\nARG TARGETARCH\nADD https://github.com/mickamy/sql-tap/releases/download/v${SQL_TAP_VERSION}/sql-tap_${SQL_TAP_VERSION}_linux_${TARGETARCH}.tar.gz /tmp/sql-tap.tar.gz\nRUN tar -xzf /tmp/sql-tap.tar.gz -C /usr/local/bin sql-tapd \u0026\u0026 rm /tmp/sql-tap.tar.gz\nENTRYPOINT [\"sql-tapd\", \"--driver=mysql\", \"--listen=:3307\", \"--upstream=localhost:3306\", \"--grpc=:9091\"]\n```\n\n## Quick start\n\n**1. Start the proxy daemon**\n\n```bash\n# PostgreSQL: proxy listens on :5433, forwards to PostgreSQL on :5432\nDATABASE_URL=\"postgres://user:pass@localhost:5432/db?sslmode=disable\" \\\n  sql-tapd --driver=postgres --listen=:5433 --upstream=localhost:5432\n\n# MySQL: proxy listens on :3307, forwards to MySQL on :3306\nDATABASE_URL=\"user:pass@tcp(localhost:3306)/db\" \\\n  sql-tapd --driver=mysql --listen=:3307 --upstream=localhost:3306\n\n# TiDB: proxy listens on :4001, forwards to TiDB on :4000\nDATABASE_URL=\"user:pass@tcp(localhost:4000)/db\" \\\n  sql-tapd --driver=tidb --listen=:4001 --upstream=localhost:4000\n```\n\n**2. Point your application at the proxy**\n\nConnect your app to the proxy port instead of the database port. No code changes needed — sql-tapd speaks the native\nwire protocol.\n\n**3. Launch the TUI**\n\n```bash\nsql-tap localhost:9091\n```\n\nAll queries flowing through the proxy appear in real-time.\n\n## Usage\n\n### sql-tapd\n\n```\nsql-tapd — SQL proxy daemon for sql-tap\n\nUsage:\n  sql-tapd [flags]\n\nFlags:\n  -driver    database driver: postgres, mysql, tidb (required)\n  -listen    client listen address (required)\n  -upstream  upstream database address (required)\n  -grpc      gRPC server address for TUI (default: \":9091\")\n  -dsn-env   env var holding DSN for EXPLAIN (default: \"DATABASE_URL\")\n  -version   show version and exit\n```\n\nSet `DATABASE_URL` (or the env var specified by `-dsn-env`) to enable EXPLAIN support. Without it, the proxy still\ncaptures queries but EXPLAIN is disabled.\n\n### sql-tap\n\n```\nsql-tap — Watch SQL traffic in real-time\n\nUsage:\n  sql-tap [flags] \u003caddr\u003e\n\nFlags:\n  -version  Show version and exit\n```\n\n`\u003caddr\u003e` is the gRPC address of sql-tapd (e.g. `localhost:9091`).\n\n## Keybindings\n\n### List view\n\n| Key               | Action                               |\n|-------------------|--------------------------------------|\n| `j` / `↓`         | Move down                            |\n| `k` / `↑`         | Move up                              |\n| `Ctrl+d` / `PgDn` | Half-page down                       |\n| `Ctrl+u` / `PgUp` | Half-page up                         |\n| `/`               | Incremental search                   |\n| `s`               | Toggle sort (chronological/duration) |\n| `Enter`           | Inspect query / transaction          |\n| `Space`           | Toggle transaction expand / collapse |\n| `Esc`             | Clear search filter                  |\n| `x`               | EXPLAIN                              |\n| `X`               | EXPLAIN ANALYZE                      |\n| `e`               | Edit query, then EXPLAIN             |\n| `E`               | Edit query, then EXPLAIN ANALYZE     |\n| `a`               | Analytics view                       |\n| `c`               | Copy query                           |\n| `C`               | Copy query with bound args           |\n| `q`               | Quit                                 |\n\n### Inspector view\n\n| Key       | Action                     |\n|-----------|----------------------------|\n| `j` / `↓` | Scroll down                |\n| `k` / `↑` | Scroll up                  |\n| `x`       | EXPLAIN                    |\n| `X`       | EXPLAIN ANALYZE            |\n| `e` / `E` | Edit and EXPLAIN / ANALYZE |\n| `c`       | Copy query                 |\n| `C`       | Copy query with bound args |\n| `q`       | Back to list               |\n\n### Analytics view\n\n| Key       | Action                       |\n|-----------|------------------------------|\n| `j` / `↓` | Move down                    |\n| `k` / `↑` | Move up                      |\n| `Ctrl+d`  | Half-page down               |\n| `Ctrl+u`  | Half-page up                 |\n| `h` / `←` | Scroll left                  |\n| `l` / `→` | Scroll right                 |\n| `s`       | Cycle sort (total/count/avg) |\n| `c`       | Copy query                   |\n| `q`       | Back to list                 |\n\n### Explain view\n\n| Key       | Action                           |\n|-----------|----------------------------------|\n| `j` / `↓` | Scroll down                      |\n| `k` / `↑` | Scroll up                        |\n| `h` / `←` | Scroll left                      |\n| `l` / `→` | Scroll right                     |\n| `c`       | Copy explain plan                |\n| `e` / `E` | Edit and re-explain / re-analyze |\n| `q`       | Back to list                     |\n\n## How it works\n\n```\n┌─────────────┐      ┌───────────────────────┐      ┌───────────────────────────┐\n│ Application │─────▶│  sql-tapd (proxy)     │─────▶│ PostgreSQL / MySQL / TiDB │\n└─────────────┘      │                       │      └───────────────────────────┘\n                     │  captures queries     │\n                     │  via wire protocol    │\n                     └───────────┬───────────┘\n                                 │ gRPC stream\n                     ┌───────────▼───────────┐\n                     │  sql-tap (TUI)        │\n                     └───────────────────────┘\n```\n\nsql-tapd parses the database wire protocol (PostgreSQL, MySQL, or TiDB) to intercept queries transparently. It tracks prepared\nstatements, parameter bindings, transactions, execution time, rows affected, and errors. Events are streamed to\nconnected TUI clients via gRPC.\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickamy%2Fsql-tap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmickamy%2Fsql-tap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickamy%2Fsql-tap/lists"}