MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_legacy_update_limit

Method test_legacy_update_limit

test/dialect/mysql/test_compiler.py:1043–1075  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1041 )
1042
1043 def test_legacy_update_limit(self):
1044 t = sql.table("t", sql.column("col1"), sql.column("col2"))
1045
1046 self.assert_compile(
1047 t.update().values({"col1": 123}), "UPDATE t SET col1=%s"
1048 )
1049 self.assert_compile(
1050 t.update()
1051 .values({"col1": 123})
1052 .with_dialect_options(mysql_limit=5),
1053 "UPDATE t SET col1=%s LIMIT 5",
1054 )
1055
1056 # does not make sense but we want this to compile
1057 self.assert_compile(
1058 t.update()
1059 .values({"col1": 123})
1060 .with_dialect_options(mysql_limit=0),
1061 "UPDATE t SET col1=%s LIMIT 0",
1062 )
1063 self.assert_compile(
1064 t.update()
1065 .values({"col1": 123})
1066 .with_dialect_options(mysql_limit=None),
1067 "UPDATE t SET col1=%s",
1068 )
1069 self.assert_compile(
1070 t.update()
1071 .where(t.c.col2 == 456)
1072 .values({"col1": 123})
1073 .with_dialect_options(mysql_limit=1),
1074 "UPDATE t SET col1=%s WHERE t.col2 = %s LIMIT 1",
1075 )
1076
1077 def test_legacy_delete_limit(self):
1078 t = sql.table("t", sql.column("col1"), sql.column("col2"))

Callers

nothing calls this directly

Calls 7

assert_compileMethod · 0.80
with_dialect_optionsMethod · 0.80
tableMethod · 0.45
columnMethod · 0.45
valuesMethod · 0.45
updateMethod · 0.45
whereMethod · 0.45

Tested by

no test coverage detected