{"id":18448249,"url":"https://github.com/mergestat/mysql-server","last_synced_at":"2025-04-08T01:32:15.661Z","repository":{"id":62866304,"uuid":"442528238","full_name":"mergestat/mysql-server","owner":"mergestat","description":"Query git repositories as MySQL","archived":false,"fork":false,"pushed_at":"2021-12-29T17:38:27.000Z","size":2574,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T03:45:41.719Z","etag":null,"topics":["git","mergestat","mysql","sql"],"latest_commit_sha":null,"homepage":"https://app.mergestat.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mergestat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-28T16:58:06.000Z","updated_at":"2024-04-22T17:30:53.000Z","dependencies_parsed_at":"2022-11-08T06:15:21.574Z","dependency_job_id":null,"html_url":"https://github.com/mergestat/mysql-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mergestat%2Fmysql-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mergestat%2Fmysql-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mergestat%2Fmysql-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mergestat%2Fmysql-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mergestat","download_url":"https://codeload.github.com/mergestat/mysql-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223296982,"owners_count":17121977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["git","mergestat","mysql","sql"],"created_at":"2024-11-06T07:15:23.418Z","updated_at":"2024-11-06T07:15:24.042Z","avatar_url":"https://github.com/mergestat.png","language":"Go","readme":"## mysql-server\n\nThis is an *experimental* implementation of a [`MergeStat`](https://github.com/mergestat/mergestat) backend for [`go-mysql-server`](https://github.com/dolthub/go-mysql-server) from DoltHub.\nThe `go-mysql-server` is a \"frontend\" SQL engine based on a MySQL syntax and wire protocol implementation.\nIt allows for pluggable \"backends\" as database and table providers.\n\n### Database\n\nWhen you connect with a MySQL client, the **database name** you specify will be a reference to a git repository.\nCurrently, this can either be an HTTP(s) URL (`https://github.com/mergestat/mergestat`) or a path to a repository on disk.\n\nFor instance, the following will list all commits from [`mergestat/mergestat`](https://github.com/mergestat/mergestat).\nThe repo is cloned to a temporary directory in the container before the query is executed.\n\n```\nmysql --host=127.0.0.1 --port=3306 \"https://github.com/mergestat/mergestat\" -u root -proot -e \"select * from commits\"\n```\n\n#### Example\n\nYou can use a MySQL client to connect to the server and execute queries.\nFor instance, the following is a query against the [React codebase](https://github.com/facebook/react) that produces a chart of **unique contributors every month** (by `author_email`), using [Arctype](https://arctype.com/):\n\n![Example Using Arctype Client](./docs/react-distinct-authors-by-month.png)\n\n```sql\nSELECT\n    count(DISTINCT author_email),\n    YEAR(author_when) AS y,\n    MONTH(author_when) AS m,\n    DATE_FORMAT(author_when, '%Y-%m')\nFROM commits\nWHERE parents \u003c 2\nGROUP BY y, m\nORDER BY y, m\n```\n\n#### Tables\n\n- `commits`\n- `refs`\n- `files`\n- `stats`\n\n### Usage\n\nThe easiest way to get started (for now) is probably by building and running a Docker container locally.\n`MergeStat` has some build dependencies (such as [`libgit2`](https://libgit2.org/)), which must be available on your system when compiling (see the `Makefile` for details).\n\nYou can use the included `docker-compose.yaml` file in this repository by running `docker compose up`.\nThis will start a MySQL server on port `3306`.\n\nYou may also run `docker build . -t mergestat/mysql-server` to produce a docker image you can run like so:\n\n```\ndocker run -p 3306:3306 -v ${PWD}:/repo mergestat/mysql-server\n```\n\nNote the `-v` flag, in the above we're mounting the current directory (assumed to be a git repo) into `/repo` in the container.\n\nThe repo path is specified by the **database name** used when connecting to the MySQL server.\nSo, in the above, you would connect like so:\n\n```\nmysql --host=127.0.0.1 --port=3306 \"/repo\" -u root -proot -e \"select hash from commits\"\n```\n\nNote the password defaults to `root`.\nThe user/password can be set by supplying the `MYSQL_USER` and `MYSQL_PWD` env vars.\n\n#### TODO\n- Publish pre-built binaries\n- Publish a Docker image\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmergestat%2Fmysql-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmergestat%2Fmysql-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmergestat%2Fmysql-server/lists"}