Query Result

A QueryResult instance is created for every query and contains the count of rows effected by the query and either the row as a dict or rows as a list of dict. For queries that do not return any data, both row and rows will be None.

class sprockets_postgres.QueryResult(row_count, row, rows)[source]

Contains the results of the query that was executed.

Parameters
  • row_count (int) – The quantity of rows impacted by the query

  • row (typing.Optional[dict]) – If a single row is returned, the data for that row

  • rows (typing.Optional[typing.List[dict]]) – If more than one row is returned, this attribute is set as the list of rows, in order.

property row_count

Return the number of rows for the result

Return type

int

property rows

Return the result as a list of one or more rows

Return type

typing.List[dict]