def tsql_query(query, **kwargs):
 try:
  cur = _get_connection(**kwargs).cursor()
  cur.execute(query)
  return loads(_MssqlEncoder().encode({'resultset': cur.fetchall()}))['resultset']
 except Exception as e:
  return (('Could not run the query',), (str(e),))

def tsql_query ( query , ** kwargs ) : try : cur = _get_connection ( ** kwargs ) . cursor ( ) cur . execute ( query ) return loads ( _MssqlEncoder ( ) . encode ( { 'resultset' : cur . fetchall ( ) } ) ) [ 'resultset' ] except Exception as e : return ( ( 'Could not run the query' , ) , ( str ( e ) , ) )
run a sql query and return query result as list of tuples .