Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Peewee orm revert包含/StartWith/endswith_Python_Python 3.x_Peewee - Fatal编程技术网

Python Peewee orm revert包含/StartWith/endswith

Python Peewee orm revert包含/StartWith/endswith,python,python-3.x,peewee,Python,Python 3.x,Peewee,我有这个,它工作得很好 Model.name.startswith(name) 但我需要这个 name.startswith(Model.name) 字段值在字符串中的出现。 Thx使用值()。注意,添加了一个通配符 Model.select().where(Value(name).startswith(Model.name)) 对应的SQL,大约为: SELECT id, name FROM model_tbl WHERE '<value in name var>' LIKE

我有这个,它工作得很好

Model.name.startswith(name)
但我需要这个

name.startswith(Model.name)
字段值在字符串中的出现。 Thx使用值()。注意,添加了一个通配符

Model.select().where(Value(name).startswith(Model.name))
对应的SQL,大约为:

SELECT id, name
FROM model_tbl
WHERE '<value in name var>' LIKE (name || '%')
选择id、name
来自型号tbl
其中“”像(名称| |'%”)

模型。名称
没有值:它描述了模型中的一个字段。如果您有一个特定的实例(例如,从以前的查询中获得的实例),询问其名称是有意义的。我需要类似的内容,但使用peewee thx非常好,但值仅存在于peewee 3版本中?第二个版本没有替代方案?