bryanyang0528/ksql-python

IndexError from client.ksql("SET ...")

MadsAdrian opened this issue · 0 comments

There seems to be an error in

ksql-python/ksql/api.py

Lines 44 to 62 in 9cd96cd

def _raise_for_status(r, response):
r_json = json.loads(response)
if r.getcode() != 200:
# seems to be the new API behavior
if r_json.get("@type") == "statement_error" or r_json.get("@type") == "generic_error":
error_message = r_json["message"]
error_code = r_json["error_code"]
stackTrace = r_json["stack_trace"]
raise KSQLError(error_message, error_code, stackTrace)
else:
raise KSQLError("Unknown Error: {}".format(r.content))
else:
# seems to be the old API behavior, so some errors have status 200, bug??
if r_json and r_json[0]["@type"] == "currentStatus" and r_json[0]["commandStatus"]["status"] == "ERROR":
error_message = r_json[0]["commandStatus"]["message"]
error_code = None
stackTrace = None
raise KSQLError(error_message, error_code, stackTrace)
return True

client.ksql("SET 'ksql.query.pull.table.scan.enabled' = 'true';")

gives IndexError: list index out of range on line 57