3

When I execute a SQL statement in Impala using Python/Impyla, I am just getting an exception with a generic error message like ""Operation is in ERROR_STATE". How do I get more detailed information about the error that occurred?

aaa90210
  • 11,295
  • 13
  • 51
  • 88

2 Answers2

1

The cursor object has a _last_operation field that can be used to get more detailed information. E.g.

        try:
            cur.execute(sql)  
        except Exception, e:
            op = cur._last_operation
            abort(400,"ERROR: %s"%op.get_log())

Output might be:

Complete (0 out of 0)
Error while flushing Kudu session
Already present: key already present
aaa90210
  • 11,295
  • 13
  • 51
  • 88
0

You can use the traceback module to print the whole error message into console:

import traceback
try: something
except: traceback.print_exec()
Kevin Gao
  • 85
  • 6