MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_limit_fetch_interaction

Method test_limit_fetch_interaction

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected