Less verbose logging in data sources.

This commit is contained in:
Arik Fraimovich 2017-05-15 16:53:47 +03:00
parent 24cd55f5cc
commit 3513d84bb8
4 changed files with 2 additions and 14 deletions

View File

@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
try:
from pyhive import hive
enabled = True
except ImportError, e:
except ImportError:
enabled = False
COLUMN_NAME = 0
@ -125,9 +125,6 @@ class Hive(BaseSQLQueryRunner):
connection.cancel()
error = "Query cancelled by user."
json_data = None
except Exception as e:
logging.exception(e)
raise sys.exc_info()[1], None, sys.exc_info()[2]
finally:
if connection:
connection.close()

View File

@ -125,20 +125,15 @@ class Impala(BaseSQLQueryRunner):
error = None
cursor.close()
except DatabaseError as e:
logging.exception(e)
json_data = None
error = e.message
except RPCError as e:
logging.exception(e)
json_data = None
error = "Metastore Error [%s]" % e.message
except KeyboardInterrupt:
connection.cancel()
error = "Query cancelled by user."
json_data = None
except Exception as e:
logging.exception(e)
raise sys.exc_info()[1], None, sys.exc_info()[2]
finally:
if connection:
connection.close()

View File

@ -162,7 +162,6 @@ class SqlServer(BaseSQLQueryRunner):
cursor.close()
except pymssql.Error as e:
logging.exception(e)
try:
# Query errors are at `args[1]`
error = e.args[1]

View File

@ -158,15 +158,12 @@ class Oracle(BaseSQLQueryRunner):
error = 'Query completed but it returned no data.'
json_data = None
except cx_Oracle.DatabaseError as err:
logging.exception(err.message)
error = "Query failed. {}.".format(err.message)
error = u"Query failed. {}.".format(err.message)
json_data = None
except KeyboardInterrupt:
connection.cancel()
error = "Query cancelled by user."
json_data = None
except Exception as err:
raise sys.exc_info()[1], None, sys.exc_info()[2]
finally:
connection.close()