Closed qtfkwk closed 2 years ago
Is there any updates on this issue?
I agree with you. The code does not make sense. After reading all lines in the file the rule
will be equal to ""
.
Therefore this lines will always rise and error:
if rule[-1:] != ";":
raise InvalidQueryError(rule)
If these lines are equal to something else than ""
that would mean the last query was invalid, and if it is equal to ";"
, this means the last rule has not bien yield, but this second scenario cannot happend within the current code. Hence, these lines should al least be changed to:
if rule[-1:] != "":
raise InvalidQueryError(rule)
The following snippet from ksql/upload.py:38 has a problem which is causing the InvalidQueryError exception to be raised when parsing a file that has one statement per line and each statement ends with a semicolon. The issue seems to be caused by
rule
being an empty string after yielding, and then the last 2 lines check that the emptyrule
ends with a semicolon... but the last rule already yielded!Believe the fix is to simply delete these lines.