{"id":18592593,"url":"https://github.com/bytebase/mysql-parser","last_synced_at":"2025-04-13T09:50:33.477Z","repository":{"id":172367466,"uuid":"649195756","full_name":"bytebase/mysql-parser","owner":"bytebase","description":"MySQL parser based on ANTLR4","archived":false,"fork":false,"pushed_at":"2024-12-24T07:12:14.000Z","size":6087,"stargazers_count":9,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T23:15:15.742Z","etag":null,"topics":["antlr","antlr-parser","antlr4","database","mysql","parser","sql","sql-parser"],"latest_commit_sha":null,"homepage":"https://www.bytebase.com","language":"ANTLR","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytebase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2023-06-04T05:01:44.000Z","updated_at":"2024-12-24T07:12:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd45dbe6-42b2-43e2-9bbc-92296488b3e3","html_url":"https://github.com/bytebase/mysql-parser","commit_stats":null,"previous_names":["bytebase/mysql-parser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Fmysql-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Fmysql-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Fmysql-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Fmysql-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytebase","download_url":"https://codeload.github.com/bytebase/mysql-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248695242,"owners_count":21146952,"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":["antlr","antlr-parser","antlr4","database","mysql","parser","sql","sql-parser"],"created_at":"2024-11-07T01:09:10.225Z","updated_at":"2025-04-13T09:50:33.457Z","avatar_url":"https://github.com/bytebase.png","language":"ANTLR","readme":"The mysql-parser is a parser for MySQL. It is based on the [ANTLR4](https://github.com/antlr/antlr4) and use the grammar from [antlr4-grammars-mysql](https://github.com/antlr/grammars-v4/tree/master/sql/mysql).\n\n## Build\n\nBefore build, you need to install the ANTLR4.\n\nrequirements:\n- https://github.com/antlr/antlr4/blob/master/doc/getting-started.md\n- https://github.com/antlr/antlr4/blob/master/doc/go-target.md\n\n```bash\n./build.sh\n```\n\n## Update grammar\n\n### Manually change the grammar file in this project\n\n1. run `./build.sh` to generate the parser code.\n\n### From antlr4-grammars-mysql\n\n1. Clone the `MySQLLexer.g4` and `MySQLParser.g4` grammar files from https://github.com/mysql/mysql-workbench/tree/8.0/library/parsers/grammars.\n1. Update the lexer and parser.\n1. run `./build.sh` to generate the parser code.\n\n\n### Updates from MySQL Workbench.\n\n1. Removed the version checks https://github.com/bytebase/mysql-parser/commit/addcea9f8779ffe95159e334d9dd1ea7f93ed32d.\n1. Used SQL Mode off by default, and removed set types https://github.com/bytebase/mysql-parser/commit/878f24d9fd313f60b3a10f977c489c0599ae2d49, https://github.com/bytebase/mysql-parser/commit/1062be07340ebc148c7119cd16e980792eeb1653.\n1. Hacked dot identifier and removed the base class of lexer and parser https://github.com/bytebase/mysql-parser/commit/1d535c32a0be05d14ffc333f08f9a17d375ce922.\n1. Follow the change logs below to update the grammar.\n\n## Test the parser\n\nRun `TestMySQLDBSQLParser` in `parser_test.go` to test the parser.\n\n```bash\ngo test -v\n```\n\n## References\n\n- ANTLR4 Getting Started https://github.com/antlr/antlr4/blob/master/doc/getting-started.md\n- ANTLR4 Go Garget https://github.com/antlr/antlr4/blob/master/doc/go-target.md\n\n## Change Logs\n\n- 2023-06-05: Support 8.0 CREATE USER statement, specifically the `[COMMENT 'comment_string' | ATTRIBUTE 'json_object']` clause.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebase%2Fmysql-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytebase%2Fmysql-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebase%2Fmysql-parser/lists"}