Returns a list of all rows for the RecordCollection. If they haven't been fetched yet, consume the iterator and cache the results.
(self, as_dict=False, as_ordereddict=False)
| 193 | return data |
| 194 | |
| 195 | def all(self, as_dict=False, as_ordereddict=False): |
| 196 | """Returns a list of all rows for the RecordCollection. If they haven't |
| 197 | been fetched yet, consume the iterator and cache the results.""" |
| 198 | |
| 199 | # By calling list it calls the __iter__ method |
| 200 | rows = list(self) |
| 201 | |
| 202 | if as_dict: |
| 203 | return [r.as_dict() for r in rows] |
| 204 | elif as_ordereddict: |
| 205 | return [r.as_dict(ordered=True) for r in rows] |
| 206 | |
| 207 | return rows |
| 208 | |
| 209 | def as_dict(self, ordered=False): |
| 210 | return self.all(as_dict=not (ordered), as_ordereddict=ordered) |