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

Function test_use_index

tests/test_queryset.py:668–673  ·  view source on GitHub ↗
(db, intfields_data)

Source from the content-addressed store, hash-verified

666@requireCapability(support_index_hint=True)
667@pytest.mark.asyncio
668async def test_use_index(db, intfields_data):
669 sql = IntFields.filter(pk=1).only("id").use_index("index_name").sql()
670 assert sql == "SELECT `id` `id` FROM `intfields` USE INDEX (`index_name`) WHERE `id`=%s"
671
672 sql_again = IntFields.filter(pk=1).only("id").use_index("index_name").sql()
673 assert sql_again == "SELECT `id` `id` FROM `intfields` USE INDEX (`index_name`) WHERE `id`=%s"
674
675
676@requireCapability(support_index_hint=True)

Callers

nothing calls this directly

Calls 4

use_indexMethod · 0.80
sqlMethod · 0.45
onlyMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…