Fetches a single record for a Model type using the provided filter parameters. .. code-block:: python3 user = await User.get(username="foo") :param using_db: The DB connection to use :param args: Q functions containing constraints. Will be AND'ed.
(
cls, *args: Q, using_db: BaseDBAsyncClient | None = None, **kwargs: Any
)
| 1555 | |
| 1556 | @classmethod |
| 1557 | def get( |
| 1558 | cls, *args: Q, using_db: BaseDBAsyncClient | None = None, **kwargs: Any |
| 1559 | ) -> QuerySetSingle[Self]: |
| 1560 | """ |
| 1561 | Fetches a single record for a Model type using the provided filter parameters. |
| 1562 | |
| 1563 | .. code-block:: python3 |
| 1564 | |
| 1565 | user = await User.get(username="foo") |
| 1566 | |
| 1567 | :param using_db: The DB connection to use |
| 1568 | :param args: Q functions containing constraints. Will be AND'ed. |
| 1569 | :param kwargs: Simple filter constraints. |
| 1570 | |
| 1571 | :raises MultipleObjectsReturned: If provided search returned more than one object. |
| 1572 | :raises DoesNotExist: If object can not be found. |
| 1573 | """ |
| 1574 | return cls._db_queryset(using_db).get(*args, **kwargs) |
| 1575 | |
| 1576 | @classmethod |
| 1577 | def raw(cls, sql: str, using_db: BaseDBAsyncClient | None = None) -> RawSQLQuery: |