获取详细的Impyla错误消息 [英] Getting detailed Impyla error message

查看:105
本文介绍了获取详细的Impyla错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Python/Impyla在Impala中执行SQL语句时,我只是收到一个异常消息,并带有诸如"Operation is in ERROR_STATE"之类的通用错误消息.如何获得有关发生的错误的更多详细信息?/p>

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?

推荐答案

游标对象具有_last_operation字段,可用于获取更多详细信息.例如

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())

输出可能是:

Complete (0 out of 0)
Error while flushing Kudu session
Already present: key already present

这篇关于获取详细的Impyla错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆