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

Method test_binds

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

Source from the content-addressed store, hash-verified

3683 __dialect__ = "default"
3684
3685 def test_binds(self):
3686 for (
3687 stmt,
3688 expected_named_stmt,
3689 expected_positional_stmt,
3690 expected_default_params_dict,
3691 expected_default_params_list,
3692 test_param_dict,
3693 expected_test_params_dict,
3694 expected_test_params_list,
3695 ) in [
3696 (
3697 select(table1, table2).where(
3698 and_(
3699 table1.c.myid == table2.c.otherid,
3700 table1.c.name == bindparam("mytablename"),
3701 ),
3702 ),
3703 "SELECT mytable.myid, mytable.name, mytable.description, "
3704 "myothertable.otherid, myothertable.othername FROM mytable, "
3705 "myothertable WHERE mytable.myid = myothertable.otherid "
3706 "AND mytable.name = :mytablename",
3707 "SELECT mytable.myid, mytable.name, mytable.description, "
3708 "myothertable.otherid, myothertable.othername FROM mytable, "
3709 "myothertable WHERE mytable.myid = myothertable.otherid AND "
3710 "mytable.name = ?",
3711 {"mytablename": None},
3712 [None],
3713 {"mytablename": 5},
3714 {"mytablename": 5},
3715 [5],
3716 ),
3717 (
3718 select(table1).where(
3719 or_(
3720 table1.c.myid == bindparam("myid"),
3721 table2.c.otherid == bindparam("myid"),
3722 ),
3723 ),
3724 "SELECT mytable.myid, mytable.name, mytable.description "
3725 "FROM mytable, myothertable WHERE mytable.myid = :myid "
3726 "OR myothertable.otherid = :myid",
3727 "SELECT mytable.myid, mytable.name, mytable.description "
3728 "FROM mytable, myothertable WHERE mytable.myid = ? "
3729 "OR myothertable.otherid = ?",
3730 {"myid": None},
3731 [None, None],
3732 {"myid": 5},
3733 {"myid": 5},
3734 [5, 5],
3735 ),
3736 (
3737 text(
3738 "SELECT mytable.myid, mytable.name, "
3739 "mytable.description FROM "
3740 "mytable, myothertable WHERE mytable.myid = :myid OR "
3741 "myothertable.otherid = :myid"
3742 ),

Callers

nothing calls this directly

Calls 14

selectFunction · 0.90
and_Function · 0.90
bindparamFunction · 0.90
or_Function · 0.90
textFunction · 0.90
eq_Function · 0.90
assert_raises_messageFunction · 0.90
assert_compileMethod · 0.80
whereMethod · 0.45
paramsMethod · 0.45
dialectMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected