繁体   English   中英

如何使用python在orientdb查询的where子句中使用变量

[英]how to use variables in where clause of orientdb query using python

代码

import pyorient

# create connection 
client = pyorient.OrientDB("localhost", 2424) 

# open databse 
client.db_open( "testDB", "admin", "admin" ) 
requiredObj = client.command(" select out().question as qlist,out().seq as qseq,out().pattern as pattern,out().errormsg as errormsg from chat where app_cat='%s' and module='%s' and type='%s' and prob_cat='%s' ",(appCategory,module,type,problemCategory))

for data in requiredObj :
    print data

上面的一个不起作用请建议替代方法

你可以使用这个命令

requiredObj = client.command("select from chat where name='%s'" % "chat 1");

或者

requiredObj = client.command("select from chat where name='%s' and room='%s'" % ("chat 1","1"));

希望能帮助到你

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM