Repository: incubator-airflow Updated Branches: refs/heads/master db07e04f9 -> 6f4696ba2
Move presto.execute inside try catch to handle error This commit fixes an issue where malformed SQL would raise a DatabaseError outside of the try catch block in the hook. This should now raise a PrestoException as expected. Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/d18a782f Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/d18a782f Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/d18a782f Branch: refs/heads/master Commit: d18a782f3beb8b6f55c85ea0c4d9894dc5550b0c Parents: 31f01b8 Author: Arthur Wiedmer <[email protected]> Authored: Thu May 12 16:15:15 2016 -0700 Committer: Arthur Wiedmer <[email protected]> Committed: Thu May 12 16:15:15 2016 -0700 ---------------------------------------------------------------------- airflow/hooks/presto_hook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/d18a782f/airflow/hooks/presto_hook.py ---------------------------------------------------------------------- diff --git a/airflow/hooks/presto_hook.py b/airflow/hooks/presto_hook.py index c445255..2acdef1 100644 --- a/airflow/hooks/presto_hook.py +++ b/airflow/hooks/presto_hook.py @@ -74,8 +74,8 @@ class PrestoHook(DbApiHook): """ import pandas cursor = self.get_cursor() - cursor.execute(self._strip_sql(hql), parameters) try: + cursor.execute(self._strip_sql(hql), parameters) data = cursor.fetchall() except DatabaseError as e: obj = eval(str(e))
