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

Function test_force_index

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

Source from the content-addressed store, hash-verified

628@requireCapability(support_index_hint=True)
629@pytest.mark.asyncio
630async def test_force_index(db, intfields_data):
631 sql = IntFields.filter(pk=1).only("id").force_index("index_name").sql()
632 assert sql == "SELECT `id` `id` FROM `intfields` FORCE INDEX (`index_name`) WHERE `id`=%s"
633
634 sql_again = IntFields.filter(pk=1).only("id").force_index("index_name").sql()
635 assert sql_again == "SELECT `id` `id` FROM `intfields` FORCE INDEX (`index_name`) WHERE `id`=%s"
636
637
638@requireCapability(support_index_hint=True)

Callers

nothing calls this directly

Calls 4

force_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…