Returns a bool value to confirm if there are rows matching the given criteria (applied with `filter` and `exclude` if set). :return: result of the check :rtype: bool
(self)
| 761 | ) |
| 762 | |
| 763 | async def exists(self) -> bool: |
| 764 | """ |
| 765 | Returns a bool value to confirm if there are rows matching the given criteria |
| 766 | (applied with `filter` and `exclude` if set). |
| 767 | |
| 768 | :return: result of the check |
| 769 | :rtype: bool |
| 770 | """ |
| 771 | expr = self.build_select_expression() |
| 772 | expr = sqlalchemy.exists(expr).select() |
| 773 | async with self.model_config.database.get_query_executor() as executor: |
| 774 | result = await executor.fetch_val(expr) |
| 775 | return bool(result) |
| 776 | |
| 777 | async def count(self, distinct: bool = True) -> int: |
| 778 | """ |