Skip to content

Parser raises an exception for not supported query type when query starts with a comment #163

@macbre

Description

@macbre

When working on index-digest's PR I have found the following issue.

An example call:

tables = get_query_tables("/* foo */ INSERT IGNORE INTO `0070_insert_ignore` VALUES (9, '123', '2017-01-01');")

Error raised:

/* foo */ INSERT IGNORE INTO `0070_insert_ignore` VALUES (9, '123', '2017-01-01');

        if self._query_type == "UNSUPPORTED":
>           raise ValueError("Not supported query type!")
E           ValueError: Not supported query type!

env/lib/python3.9/site-packages/sql_metadata/parser.py:94: ValueError

Additionally, we should also log the query itself that caused this exception to be raised.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions