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

Method exists

tortoise/models.py:1591–1605  ·  view source on GitHub ↗

Return True/False whether record exists with the provided filter parameters. .. code-block:: python3 result = await User.exists(username="foo") :param using_db: The specific DB connection to use. :param args: Q functions containing constraints. Will be

(
        cls: type[MODEL], *args: Q, using_db: BaseDBAsyncClient | None = None, **kwargs: Any
    )

Source from the content-addressed store, hash-verified

1589
1590 @classmethod
1591 def exists(
1592 cls: type[MODEL], *args: Q, using_db: BaseDBAsyncClient | None = None, **kwargs: Any
1593 ) -> ExistsQuery:
1594 """
1595 Return True/False whether record exists with the provided filter parameters.
1596
1597 .. code-block:: python3
1598
1599 result = await User.exists(username="foo")
1600
1601 :param using_db: The specific DB connection to use.
1602 :param args: Q functions containing constraints. Will be AND'ed.
1603 :param kwargs: Simple filter constraints.
1604 """
1605 return cls._db_queryset(using_db).filter(*args, **kwargs).exists()
1606
1607 @classmethod
1608 def get_or_none(

Callers 15

tortoise_orm_configFunction · 0.45
test_existsFunction · 0.45
test_existsFunction · 0.45
test_existsFunction · 0.45
test_noid_existsFunction · 0.45

Calls 2

_db_querysetMethod · 0.80
filterMethod · 0.45