def __do_query_into_hash(conn, sql_str):
 mod = sys._getframe().f_code.co_name
 log.debug('{0}<--({1})'.format(mod, sql_str))
 rtn_results = []
 try:
  cursor = conn.cursor()
 except MySQLdb.MySQLError:
  log.error("{0}: Can't get cursor for SQL->{1}".format(mod, sql_str))
  cursor.close()
  log.debug('{0}-->'.format(mod))
  return rtn_results
 try:
  _execute(cursor, sql_str)
 except MySQLdb.MySQLError:
  log.error('{0}: try to execute : SQL->{1}'.format(mod, sql_str))
  cursor.close()
  log.debug('{0}-->'.format(mod))
  return rtn_results
 qrs = cursor.fetchall()
 for row_data in qrs:
  col_cnt = 0
  row = {}
  for col_data in cursor.description:
   col_name = col_data[0]
   row[col_name] = row_data[col_cnt]
   col_cnt += 1
  rtn_results.append(row)
 cursor.close()
 log.debug('{0}-->'.format(mod))
 return rtn_results

def __do_query_into_hash ( conn , sql_str ) : mod = sys . _getframe ( ) . f_code . co_name log . debug ( '{0}<--({1})' . format ( mod , sql_str ) ) rtn_results = [ ] try : cursor = conn . cursor ( ) except MySQLdb . MySQLError : log . error ( "{0}: Can't get cursor for SQL->{1}" . format ( mod , sql_str ) ) cursor . close ( ) log . debug ( '{0}-->' . format ( mod ) ) return rtn_results try : _execute ( cursor , sql_str ) except MySQLdb . MySQLError : log . error ( '{0}: try to execute : SQL->{1}' . format ( mod , sql_str ) ) cursor . close ( ) log . debug ( '{0}-->' . format ( mod ) ) return rtn_results qrs = cursor . fetchall ( ) for row_data in qrs : col_cnt = 0 row = { } for col_data in cursor . description : col_name = col_data [ 0 ] row [ col_name ] = row_data [ col_cnt ] col_cnt += 1 rtn_results . append ( row ) cursor . close ( ) log . debug ( '{0}-->' . format ( mod ) ) return rtn_results
perform the query that is passed to it .