#NEWLINE# def execute( self , query , async = False ) : #NEWLINE# #INDENT# if isinstance ( query , DDL ) : #NEWLINE# #INDENT# query = query . compile ( ) #NEWLINE# #UNINDENT# cursor = self . _get_cursor ( ) #NEWLINE# self . log ( query ) #NEWLINE# try : #NEWLINE# #INDENT# cursor . execute ( query , async = async ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# cursor . release ( ) #NEWLINE# import traceback #NEWLINE# buf = six . StringIO ( ) #NEWLINE# traceback . print_exc ( file = buf ) #NEWLINE# self . error ( 'Exception caused by {0}: {1}' . format ( cursor , buf . getvalue ( ) ) ) #NEWLINE# raise #NEWLINE# #UNINDENT# return cursor