MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_limit_fetch_interaction

Method test_limit_fetch_interaction

test/sql/test_compiler.py:510–535  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

508 )
509
510 def test_limit_fetch_interaction(self):
511 self.assert_compile(
512 select(1).limit(42).fetch(1),
513 "SELECT 1 FETCH FIRST :param_1 ROWS ONLY",
514 checkparams={"param_1": 1},
515 )
516 self.assert_compile(
517 select(1).fetch(42).limit(1),
518 "SELECT 1 LIMIT :param_1",
519 checkparams={"param_1": 1},
520 )
521 self.assert_compile(
522 select(1).limit(42).offset(7).fetch(1),
523 "SELECT 1 OFFSET :param_1 ROWS FETCH FIRST :param_2 ROWS ONLY",
524 checkparams={"param_1": 7, "param_2": 1},
525 )
526 self.assert_compile(
527 select(1).fetch(1).slice(2, 5),
528 "SELECT 1 LIMIT :param_1 OFFSET :param_2",
529 checkparams={"param_1": 3, "param_2": 2},
530 )
531 self.assert_compile(
532 select(1).slice(2, 5).fetch(1),
533 "SELECT 1 OFFSET :param_1 ROWS FETCH FIRST :param_2 ROWS ONLY",
534 checkparams={"param_1": 2, "param_2": 1},
535 )
536
537 def test_select_precol_compile_ordering(self):
538 s1 = (

Callers

nothing calls this directly

Calls 6

selectFunction · 0.90
assert_compileMethod · 0.80
fetchMethod · 0.45
limitMethod · 0.45
offsetMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected