(self)
| 368 | return self._iter().__iter__() |
| 369 | |
| 370 | def _iter(self): |
| 371 | bq = self.bq |
| 372 | |
| 373 | if not self.session.enable_baked_queries or bq._spoiled: |
| 374 | return self._as_query()._iter() |
| 375 | |
| 376 | query, statement = bq._bakery.get( |
| 377 | bq._effective_key(self.session), (None, None) |
| 378 | ) |
| 379 | if query is None: |
| 380 | query, statement = bq._bake(self.session) |
| 381 | |
| 382 | if self._params: |
| 383 | q = query.params(self._params) |
| 384 | else: |
| 385 | q = query |
| 386 | for fn in self._post_criteria: |
| 387 | q = fn(q) |
| 388 | |
| 389 | params = q._params |
| 390 | execution_options = dict(q._execution_options) |
| 391 | execution_options.update( |
| 392 | { |
| 393 | "_sa_orm_load_options": q.load_options, |
| 394 | "compiled_cache": bq._bakery, |
| 395 | } |
| 396 | ) |
| 397 | |
| 398 | result = self.session.execute( |
| 399 | statement, params, execution_options=execution_options |
| 400 | ) |
| 401 | if result._attributes.get("is_single_entity", False): |
| 402 | result = result.scalars() |
| 403 | |
| 404 | if result._attributes.get("filtered", False): |
| 405 | result = result.unique() |
| 406 | |
| 407 | return result |
| 408 | |
| 409 | def count(self): |
| 410 | """return the 'count'. |
no test coverage detected