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

View File

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

View File

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

View File

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