AS库连接如何用python去进行编写。
def 获取AS库账务静态表DSP_Agreement数据信息的customerno(self):
as_servers = ["11.1x3.0.x3"]
retryTimes =0
while retryTimes <3:
get_value = as_get_value_by_condition(as_servers,3000,"dsp","agreement","PREFIXKEY1",self.feature.pk,['CUST_NO'])
if get_value =="{}":
retryTimes = retryTimes +1
print("第"+str(retryTimes)+"次重试..."
sleep(10)
else:
break
if get_value =="{}":
assert_that(False,"请检查job是否运行正常")
print(get_value)
retrun self.get_value
def as_get_value_by_conditon(myhostname,myport,mynamespace,myset,index,index_value,bin_name_list=None):
myport = int(myport)
jarpath=os.path.dirname(os.path.realpath(file) )+os.sep +'aerospikedemo-1.0-SNAPSHOT-jar-with-dependencies.jar'
#启动java虚拟机
if not isJVMStarted(): #如果jvm没启动才执行启动操作
startJVM(getDefaultJVMPath(),"-ea","-Djava.class.path=%s" %jarpath
as_connect_ = JClass('test0.AerospikeTest')
as_connect = as_connect_
conditions = java.util.HashMap()
conditions.put(index,str(index_value))
if bin_name_list ==None:
result = as_connect.queryByCondition(myhostname,myport,mynamespace,myset,conditions)
else;
fields = java.util.HashSet()
for fields in bin_name_list:
fields.add(field)
result = as_connect.queryByConditionAndReturnBin(myhostname,myport,mynamespace,myset,conditions)
if not isJVMStarted():
shutdownJVM()
retrun str(result)
网友评论