{"id":17277781,"url":"https://github.com/sassman/edu-sql-parser-rs","last_synced_at":"2025-09-02T08:34:59.524Z","repository":{"id":137877812,"uuid":"308478474","full_name":"sassman/edu-sql-parser-rs","owner":"sassman","description":"SQL Types transpiles `CREATE TABLE` SQL code into type definitions in other languages such as TypeScript or Rust.","archived":false,"fork":false,"pushed_at":"2020-11-10T08:32:22.000Z","size":17,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T14:19:35.813Z","etag":null,"topics":["compiler","languages","parser","rust","sql","sql-parser","transpiler","typegen","typescript"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/sassman.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-29T23:56:22.000Z","updated_at":"2023-11-05T18:39:15.000Z","dependencies_parsed_at":"2024-06-02T12:55:23.600Z","dependency_job_id":null,"html_url":"https://github.com/sassman/edu-sql-parser-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sassman/edu-sql-parser-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Fedu-sql-parser-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Fedu-sql-parser-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Fedu-sql-parser-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Fedu-sql-parser-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sassman","download_url":"https://codeload.github.com/sassman/edu-sql-parser-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Fedu-sql-parser-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273256921,"owners_count":25073527,"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","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"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":["compiler","languages","parser","rust","sql","sql-parser","transpiler","typegen","typescript"],"created_at":"2024-10-15T09:09:56.277Z","updated_at":"2025-09-02T08:34:59.487Z","avatar_url":"https://github.com/sassman.png","language":"Rust","readme":"## SQL Types\n\nWIP: SQL Types transpiles `CREATE TABLE` SQL code into type definitions in other languages such as TypeScript or Rust. \n\n## Syntax\n\nBasic syntax rules:\n```ebnf\n\u003cdigit\u003e ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n\u003cletter\u003e ::= a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z\n\n\u003cany_character\u003e ::= !!any character.\n\n\u003cdollar_sign\u003e ::= $\n\n\u003cdouble_quotes\u003e ::= \"\n\n\u003cunderscore\u003e ::= _\n\n\u003cidentifier\u003e ::= \u003csimple_identifier\u003e | \u003cspecial_identifier\u003e\n\n\u003csimple_identifier\u003e ::= {\u003cletter\u003e | \u003cunderscore\u003e} [{\u003cletter\u003e | \u003cdigit\u003e | \u003cunderscore\u003e | \u003chash_symbol\u003e | \u003cdollar_sign\u003e}...]\n\n\u003cspecial_identifier\u003e ::= \u003cdouble_quotes\u003e\u003cany_character\u003e...\u003cdouble_quotes\u003e\n\n// note: original definition is \u003cunicode_name\u003e instead of \u003cidentifier\u003e\n\u003cschema_name\u003e ::= \u003cidentifier\u003e\n```\n\n### Create Table Syntax\n\nCurrently Work in progress\n\n```\n// simplified version\nCREATE [ \u003ctable_type\u003e ] \u003ctable_name\u003e\n [\u003ctable_contents_source\u003e\n [\u003csystem_versioning_spec\u003e]\n [\u003capplication_time_period_configuration\u003e]\n [\u003cbi_temporal_table_spec\u003e]\n [\u003cwith_association_clause\u003e]\n [\u003cwith_annotation_clause\u003e]\n [\u003cwith_mask_clause\u003e]\n [\u003clogging_option\u003e]\n [\u003cauto_merge_option\u003e]\n [\u003cunload_priority_clause\u003e]\n [\u003cschema_flexibility_option\u003e]\n [\u003cpartition_clause\u003e]\n [\u003cpersistent_memory_spec_clause\u003e]\n [\u003cgroup_option_list\u003e]\n [\u003clocation_clause\u003e]\n [\u003creplica_clause\u003e]\n [\u003cglobal_temporary_option\u003e]\n [\u003cseries_clause\u003e]\n [\u003cunused_retention_period_option\u003e]\n [\u003crecord_commit_timestamp_clause\u003e]\n [COMMENT \u003ccomment_string\u003e]\n [\u003cnuma_node_preference_clause\u003e]\n [\u003cload_unit\u003e]\n\n// simplified version\n\u003ctable_type\u003e ::= [ COLUMN ] TABLE\n\u003ctable_name\u003e ::= [\u003cschema_name\u003e.]\u003cidentifier\u003e\n\n// simplified version\n\u003ctable_contents_source\u003e ::=\n (\u003ctable_element\u003e, ...) [\u003cwith_association_clause\u003e]\n\n\u003ctable_element\u003e ::=\n   \u003ccolumn_definition\u003e [ \u003ccolumn_constraint\u003e ]\n | \u003ctable_constraint\u003e\n\n\u003ccolumn_definition\u003e ::= \u003ccolumn_name\u003e { \u003cdata_type\u003e | \u003clob_data_type\u003e }\n [ \u003cddic_data_type\u003e ]\n [ \u003cdefault_value_clause\u003e ]\n [ \u003cclientside_encryption\u003e ]\n [ \u003ccol_gen_as_expression\u003e | \u003ccol_gen_as_ident\u003e ]\n [ \u003ccol_calculated_field\u003e ]\n [ \u003cschema_flexibility\u003e ]\n [ \u003cfuzzy_search_index\u003e ]\n [ \u003cfuzzy_search_mode\u003e ]\n [ \u003cpersistent_memory_spec_clause\u003e ]\n [ COMMENT \u003ccomment_string\u003e ]\n [ \u003cload_unit\u003e ]\n [ \u003cnuma_node_preference_clause\u003e ]\n  \n\u003ccolumn_name\u003e ::= \u003cidentifier\u003e\n\n\u003cdata_type\u003e ::=\n DATE\n | TIME\n | SECONDDATE\n | TIMESTAMP\n | TINYINT\n | SMALLINT\n | INT\n | BIGINT\n | SMALLDECIMAL\n | REAL\n | DOUBLE\n | TEXT\n | BINTEXT\n | VARCHAR [ (\u003cunsigned_integer\u003e) ]\n | NVARCHAR [ (\u003cunsigned_integer\u003e) ]\n | ALPHANUM [ (\u003cunsigned_integer\u003e) ]\n | VARBINARY [ (\u003cunsigned_integer\u003e) ]\n | SHORTTEXT [ (\u003cunsigned_integer\u003e) ]\n | DECIMAL [ (\u003cunsigned_integer\u003e [, \u003cunsigned_integer\u003e ]) ]\n | FLOAT [ (\u003cunsigned_integer\u003e) ]\n | BOOLEAN\n\n\u003cdefault_value_clause\u003e ::= DEFAULT \u003cdefault_value_exp\u003e\n\n\u003cdefault_value_exp\u003e ::=\n NULL\n | \u003cstring_literal\u003e\n | \u003csigned_numeric_literal\u003e \u003cunsigned_numeric_literal\u003e\n | \u003cdatetime_value_function\u003e\n\n\u003cdatetime_value_function\u003e ::=\n CURRENT_DATE\n | CURRENT_TIME\n | CURRENT_TIMESTAMP\n | CURRENT_UTCDATE\n | CURRENT_UTCTIME\n | CURRENT_UTCTIMESTAMP\n \n\u003ccomment_string\u003e ::= \u003cstring_literal\u003e\n\n\u003ccolumn_constraint\u003e ::=\n NULL\n | NOT NULL\n | { HIDDEN | NOT HIDDEN }\n | [ \u003cconstraint_name_definition\u003e ] \u003cunique_specification\u003e\n | [ \u003cconstraint_name_definition\u003e ] \u003creferences_specification\u003e\n \n\u003cunique_specification\u003e ::=\n UNIQUE [ \u003cunique_tree_type_index\u003e ]\n | PRIMARY KEY [ \u003cunique_tree_type_index\u003e | \u003cunique_inverted_type_index\u003e ]\n\n\u003cunique_tree_type_index\u003e ::= { BTREE | CPBTREE }\n\u003cunique_inverted_type_index\u003e ::= INVERTED [ \u003ccomposite_type\u003e ]\n\u003ccomposite_type\u003e ::= { HASH | VALUE | INDIVIDUAL }\n\n```\n\n[hana/sql]: https://help.sap.com/doc/9b40bf74f8644b898fb07dabdd2a36ad/2.0.04/en-US/SAP_HANA_SQL_Reference_Guide_en.pdf\n\n## Usage\n\nthere is a little interactive shell to enter SQL and get parsed AST expressions back.\n\n```sh\n❯ cargo run\n\u003e\u003e\u003e x\nParsing error at line 1 column 1. No repair sequences found.\n\u003e\u003e\u003e CREATE TABLE abc(A INT)\nExpr (create table): abc\n```\n\n## License\n\n- **[GNU GPL v3 license](https://www.gnu.org/licenses/gpl-3.0)**\n- Copyright 2020 © [Sven Assmann][2].\n\n[2]: https://www.d34dl0ck.me\n[4]: https://github.com/sassman/sql-types-rs/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22\n[5]: https://github.com/sassman/sql-types-rs/issues/new/choose\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsassman%2Fedu-sql-parser-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsassman%2Fedu-sql-parser-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsassman%2Fedu-sql-parser-rs/lists"}