delete

DataTableKingBase.delete(where)

删除数据表的数据

参数

where (Union[str, Term, EmptyCriterion]) – 删除条件

示例

tbl = DataTableMySQL("example")
t = tbl.table
where = (
    ((t.col_a > 1) | (t.col_b == '23'))
    &
    (t.col_c.isin([1, 2, 3]) | t.col_d.like('f%'))
)
tbl.delete(where)

将执行sql:

DELETE
FROM
    `example`
WHERE
    (`col_a`>1
    OR `col_b`= '23')
    AND (`col_c` IN (1, 2, 3)
    OR `col_d` LIKE 'f%')

警告

where参数对 str 格式的支持会在将来移除,请按照示例中的调用方式使用。

返回类型

CustomSqlRespDTO