MCPcopy
hub / github.com/tortoise/tortoise-orm / get

Method get

tortoise/models.py:1557–1574  ·  view source on GitHub ↗

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
    )

Source from the content-addressed store, hash-verified

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:

Callers 15

configure_psycopgFunction · 0.45
get_current_contextFunction · 0.45
dbMethod · 0.45
from_dictMethod · 0.45
from_dictMethod · 0.45
from_dictMethod · 0.45
_get_connectionFunction · 0.45
resolveMethod · 0.45
_process_filter_kwargMethod · 0.45
get_use_tzFunction · 0.45
get_timezoneFunction · 0.45
execute_pypikaFunction · 0.45

Calls 1

_db_querysetMethod · 0.80