Yields individual rows until no more rows
        exist in query result. Applies row formatter if such exists.
511263
def _row_generator(self, cursor):
        
        rowset = cursor.fetchmany(self._arraysize)
        while rowset:
            if self._row_formatter is not None:
                rowset = (self._row_formatter(r, cursor) for r in rowset)
            for row in rowset:
                yield row
            rowset = cursor.fetchmany(self._arraysize)
288467
def debug_query_result(rows: Sequence[Any]) -> None:
    """"""
    log.info("Retrieved {} rows", len(rows))
    for i in range(len(rows)):
        log.info("Row {}: {}", i, rows[i])
160547
def next_row(self):
        """"""
        row = self.currentIndex().row()
        rows = self.source_model.rowCount()
        if row + 1 == rows:
            row = -1
        self.selectRow(row + 1)
751007
def select(self, rows, status=True, progress=True):
        ""
        before = len(self._selectedRows)
        if options.bulk_select_clear:
            self._selectedRows.clear()
        for r in (Progress(rows, 'selecting') if progress else rows):
            self.selectRow(r)
        if status:
            if options.bulk_select_clear:
                msg = 'selected %s %s%s' % (len(self._selectedRows), self.rowtype, ' instead' if before > 0 else '')
            else:
                msg = 'selected %s%s %s' % (len(self._selectedRows)-before, ' more' if before > 0 else '', self.rowtype)
            vd.status(msg)
736005
def rows(self):
        """"""


        for s_name, s in self.sections.items():

            # Yield the section header
            if s.name != 'Root':
                yield ['']  # Unecessary, but makes for nice formatting. Should actually be done just before write
                yield ['Section', s.value] + s.property_names

            # Yield all of the rows for terms in the section
            for row in s.rows:
                term, value = row

                term = term.replace('root.', '').title()

                try:
                    yield [term] + value
                except:
                    yield [term] + [value]
800897
def rows(self):
        

        yield [self.index.name] + list(self.columns)

        for t in self.itertuples():
            yield list(t)
1222328
def get(self, query, *parameters, **kwargs):
        """"""
        rows = self.query(query, *parameters, **kwargs)
        if not rows:
            return None
        elif len(rows) > 1:
            raise ValueError('Multiple rows returned for get() query')
        else:
            return rows[0]
553784
def row_iter(self):
        """"""
        for k in utils.range_(self.side):
            yield self.row(k)
633116
def execute(self, query):
        
        c = self.conn.cursor()
        result = c.execute(query)
        for i in result:
            yield i
968144
def query(self, sql, *args, **kwargs):
        
        with self.locked() as conn:
            for row in conn.query(sql, *args, **kwargs):
                yield row
1021728
def prepare_rows(self,
                     rows,
                     indent,
                     has_header):

        ''''''

        out = []

        def row_wrapper(row):
            new_rows = [
                self.wrapfunc(item).split('\n')
                for item in row
            ]
            rows = []
            for item in map(lambda *args: args, *new_rows):
                if isinstance(item, (tuple, list)):
                    rows.append([substr or '' for substr in item])
                else:
                    rows.append([item])
            return rows

        logical_rows = [
            row_wrapper(row)
            for row in rows
        ]

        columns = map(lambda *args: args, *reduce(operator.add, logical_rows))

        max_widths = [
            max([len(six.text_type(item)) for item in column])
            for column in columns
        ]
        row_separator = self.row_delimiter * (len(self.prefix) + len(self.suffix) + sum(max_widths) +
                                              len(self.delim) * (len(max_widths) - 1))

        justify = self._JUSTIFY_MAP[self.justify.lower()]

        if self.separate_rows:
            out.append(
                self.ustring(
                    indent,
                    self.LIGHT_GRAY,  # pylint: disable=no-member
                    row_separator
                )
            )
        for physical_rows in logical_rows:
            for row in physical_rows:
                line = self.prefix \
                        + self.delim.join([
                                justify(six.text_type(item), width)
                                for (item, width) in zip(row, max_widths)
                        ]) + self.suffix
                out.append(
                    self.ustring(
                        indent,
                        self.WHITE,  # pylint: disable=no-member
                        line
                    )
                )
            if self.separate_rows or has_header:
                out.append(
                    self.ustring(
                        indent,
                        self.LIGHT_GRAY,  # pylint: disable=no-member
                        row_separator
                    )
                )
                has_header = False
        return out
1254037
def _select_batched(self, table, cols, num_rows, limit, queries_per_batch=3, execute=True):
        """"""
        # Execute select queries in small batches to avoid connection timeout
        commands, offset = [], 0
        while num_rows > 0:
            # Use number of rows as limit if num_rows < limit
            _limit = min(limit, num_rows)

            # Execute select_limit query
            commands.append(self._select_limit_statement(table, cols=cols, offset=offset, limit=limit))
            offset += _limit
            num_rows += -_limit

        # Execute commands
        if execute:
            rows = []
            til_reconnect = queries_per_batch
            for c in commands:
                if til_reconnect == 0:
                    self.disconnect()
                    self.reconnect()
                    til_reconnect = queries_per_batch
                rows.extend(self.fetch(c, False))
                til_reconnect += -1
            del commands
            return rows
        # Return commands
        else:
            return commands
1327563
def enumerate_query_by_limit(q, limit=1000):
    
    for offset in count(0, limit):
        r = q.offset(offset).limit(limit).all()

        for row in r:
            yield row

        if len(r) < limit:
            break
1215702
private boolean nextWithoutLimit() throws SQLException {
		if (maxRows > 0 && rowsFetched >= maxRows) {
			System.out.println("Reach max rows " + maxRows);
			return false;
		}

		if ((recordItr == null || !recordItr.hasNext()) && !emptyResultSet) {
			TSFetchResultsReq req = new TSFetchResultsReq(sql, fetchSize);

			try {
				TSFetchResultsResp resp = client.fetchResults(req);
				Utils.verifySuccess(resp.getStatus());
				if (!resp.hasResultSet) {
					emptyResultSet = true;
				} else {
					TSQueryDataSet tsQueryDataSet = resp.getQueryDataSet();
					List<RowRecord> records = Utils.convertRowRecords(tsQueryDataSet);
					recordItr = records.iterator();
				}
			} catch (TException e) {
				throw new SQLException("Cannot fetch result from server, because of network connection");
			}

		}
		if (emptyResultSet) {
			return false;
		}
		record = recordItr.next();
		// if(record.getDeltaObjectType() != null &&
		// record.getDeltaObjectType().equals(AGGREGATION_STR)){
		// if(columnInfo.containsKey(TIMESTAMP_STR)){
		// columnInfo.remove(TIMESTAMP_STR);
		// }
		// }

		rowsFetched++;
        // maxRows is a constraint that exists in parallel with the LIMIT&SLIMIT constraints,
        // so rowsFetched will increase whenever the row is fetched,
        // regardless of whether the row satisfies the LIMIT&SLIMIT constraints or not.

		return true;
	}
584621
def iterrows(self, index=True):
        
        for i in range(len(self._index)):
            row = {self._index_name: self._index[i]} if index else dict()
            for c, col in enumerate(self._columns):
                row[col] = self._data[c][i]
            yield row
1338229
def record_rows(view, limit)
      en = Enumerator.new do |e|
        view_opts = {include_docs: true, stream: false, limit: limit}
        rows_retrieved = 0
        total_rows = nil
        loop do
          v = client.view(view, view_opts)
          total_rows ||= v.total_rows
          rows_retrieved += v.rows.size
          v.rows.each do |row|
            next if row['id'].start_with?('_design')
            e.yield row
          end
          break if rows_retrieved == total_rows
          view_opts[:startkey] = v.rows.last['id'] + '0'
        end
      end
      en.lazy
    end
106733
def format_row(row, bounds, columns):
        """"""
        for c in columns:
            if c not in row:
                continue

            if "format" in columns[c]:
                row[c] = columns[c]["format"] % row[c]

            if c in bounds:
                b = bounds[c]
                row[c] = [b["min"],row[b["lower"]], row[b["upper"]], b["max"]]

        return row