Feature request: support query type 'CREATE INDEX'
LanDinh opened this issue · comments
When trying to parse queries of the type CREATE INDEX
, the Parser
fails. It seems like this is currently not supported!
Stacktrace from within sql-metadata:
File "/code/backend/core/sawmill/.venv/lib/python3.10/site-packages/sql_metadata/parser.py", line 344, in tables
with_names = self.with_names
File "/code/backend/core/sawmill/.venv/lib/python3.10/site-packages/sql_metadata/parser.py", line 441, in with_names
for token in self._not_parsed_tokens:
File "/code/backend/core/sawmill/.venv/lib/python3.10/site-packages/sql_metadata/parser.py", line 626, in _not_parsed_tokens
return [x for x in self.tokens if x.token_type is None]
File "/code/backend/core/sawmill/.venv/lib/python3.10/site-packages/sql_metadata/parser.py", line 179, in tokens
_ = self.query_type
File "/code/backend/core/sawmill/.venv/lib/python3.10/site-packages/sql_metadata/parser.py", line 122, in query_type
raise ValueError("Not supported query type!")
Example query:
CREATE INDEX "microservice_serviceregist_khaleesi_gate_id_a65c66ac" ON "microservice_serviceregistrykhaleesiservice" ("khaleesi_gate_id")
https://dev.mysql.com/doc/refman/8.0/en/create-index.html
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
[index_type]
ON tbl_name (key_part,...)
[index_option]
[algorithm_option | lock_option] ...