2016-09-14 2 views
-2

Codewie Variablen verwenden, in denen Klausel Orientdb Abfrage mit 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 

die oben man alternative Art und Weise nicht funktioniert bitte vorschlagen

+0

funktioniert nicht * wie *? Was geschieht? Welche Fehler haben Sie? –

Antwort

1

Sie konnten verwenden Sie diesen Befehl

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

oder

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

Hope it help

Verwandte Themen