def query(self, sql, rec_name='Record', dtype='namedtuple', limit=None, echo=True, retrying=False, log=log):
    'Select from SQL, return list of namedtuples'
    self.reconnect(min_tresh=10)
    s_t = datetime.datetime.now()
    _data = list(self.stream(sql, dtype=dtype, echo=False, limit=limit))
    if (not self.result.closed):
        self.result.close()
    fields = self._fields
    if (not fields):
        return []
    if (dtype == 'namedtuple'):
        Record = namedtuple(rec_name.replace(' ', '_').replace('.', '_'), fields)
        if limit:
            data = [Record(*row) for row in _data]
        else:
            data = [Record(*row) for row in _data]
    elif (dtype == 'tuple'):
        if limit:
            data = [tuple(row) for row in _data]
        else:
            data = [tuple(row) for row in _data]
    elif (dtype == 'dataframe'):
        if limit:
            data = pandas.DataFrame([row for row in _data], columns=fields)
        else:
            data = pandas.DataFrame([row for row in _data], columns=fields)
    else:
        raise Exception('{} is not recongnized.'.format(dtype))
    secs = (datetime.datetime.now() - s_t).total_seconds()
    rate = round((len(data) / secs), 1)
    if echo:
        log(' >>> Got {} rows in {} secs [{} r/s].'.format(len(data), secs, rate))
    return data
Select from SQL, return list of namedtuples
def query(self, sql, rec_name='Record', dtype='namedtuple', limit=None, echo=True, retrying=False, log=log):
    
    self.reconnect(min_tresh=10)
    s_t = datetime.datetime.now()
    _data = list(self.stream(sql, dtype=dtype, echo=False, limit=limit))
    if (not self.result.closed):
        self.result.close()
    fields = self._fields
    if (not fields):
        return []
    if (dtype == 'namedtuple'):
        Record = namedtuple(rec_name.replace(' ', '_').replace('.', '_'), fields)
        if limit:
            data = [Record(*row) for row in _data]
        else:
            data = [Record(*row) for row in _data]
    elif (dtype == 'tuple'):
        if limit:
            data = [tuple(row) for row in _data]
        else:
            data = [tuple(row) for row in _data]
    elif (dtype == 'dataframe'):
        if limit:
            data = pandas.DataFrame([row for row in _data], columns=fields)
        else:
            data = pandas.DataFrame([row for row in _data], columns=fields)
    else:
        raise Exception('{} is not recongnized.'.format(dtype))
    secs = (datetime.datetime.now() - s_t).total_seconds()
    rate = round((len(data) / secs), 1)
    if echo:
        log(' >>> Got {} rows in {} secs [{} r/s].'.format(len(data), secs, rate))
    return data