MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_binds

Method test_binds

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

Source from the content-addressed store, hash-verified

3888 __dialect__ = "default"
3889
3890 def test_binds(self):
3891 for (
3892 stmt,
3893 expected_named_stmt,
3894 expected_positional_stmt,
3895 expected_default_params_dict,
3896 expected_default_params_list,
3897 test_param_dict,
3898 expected_test_params_dict,
3899 expected_test_params_list,
3900 ) in [
3901 (
3902 select(table1, table2).where(
3903 and_(
3904 table1.c.myid == table2.c.otherid,
3905 table1.c.name == bindparam("mytablename"),
3906 ),
3907 ),
3908 "SELECT mytable.myid, mytable.name, mytable.description, "
3909 "myothertable.otherid, myothertable.othername FROM mytable, "
3910 "myothertable WHERE mytable.myid = myothertable.otherid "
3911 "AND mytable.name = :mytablename",
3912 "SELECT mytable.myid, mytable.name, mytable.description, "
3913 "myothertable.otherid, myothertable.othername FROM mytable, "
3914 "myothertable WHERE mytable.myid = myothertable.otherid AND "
3915 "mytable.name = ?",
3916 {"mytablename": None},
3917 [None],
3918 {"mytablename": 5},
3919 {"mytablename": 5},
3920 [5],
3921 ),
3922 (
3923 select(table1).where(
3924 or_(
3925 table1.c.myid == bindparam("myid"),
3926 table2.c.otherid == bindparam("myid"),
3927 ),
3928 ),
3929 "SELECT mytable.myid, mytable.name, mytable.description "
3930 "FROM mytable, myothertable WHERE mytable.myid = :myid "
3931 "OR myothertable.otherid = :myid",
3932 "SELECT mytable.myid, mytable.name, mytable.description "
3933 "FROM mytable, myothertable WHERE mytable.myid = ? "
3934 "OR myothertable.otherid = ?",
3935 {"myid": None},
3936 [None, None],
3937 {"myid": 5},
3938 {"myid": 5},
3939 [5, 5],
3940 ),
3941 (
3942 text(
3943 "SELECT mytable.myid, mytable.name, "
3944 "mytable.description FROM "
3945 "mytable, myothertable WHERE mytable.myid = :myid OR "
3946 "myothertable.otherid = :myid"
3947 ),

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