Add lark import error (#7465)

This commit is contained in:
Bagatur
2023-07-10 03:21:23 -04:00
committed by GitHub
parent bcab894f4e
commit 04cddfba0d

View File

@@ -145,6 +145,11 @@ def get_parser(
Returns:
Lark parser for the query language.
"""
# QueryTransformer is None when Lark cannot be imported.
if QueryTransformer is None:
raise ImportError(
"Cannot import lark, please install it with 'pip install lark'."
)
transformer = QueryTransformer(
allowed_comparators=allowed_comparators, allowed_operators=allowed_operators
)