本文整理汇总了Python中sensor.Sensor.select方法的典型用法代码示例。如果您正苦于以下问题:Python Sensor.select方法的具体用法?Python Sensor.select怎么用?Python Sensor.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sensor.Sensor
的用法示例。
在下文中一共展示了Sensor.select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_station2
# 需要导入模块: from sensor import Sensor [as 别名]
# 或者: from sensor.Sensor import select [as 别名]
def delete_station2(inData):
'''
:param inData:
:return:{
2:'there is no id in inData',
3:'there is no such id'
}
'''
ret=0
if(not inData.has_key('id')):
ret=2
return ret
query=session.query(Station)
tmpStation=query.filter(Station.id==inData['id']).first()
if(tmpStation==None):
ret=3
return ret
else:
from sensor import Sensor
tmpAllSensor=Sensor.select({'stationId': tmpStation.id})
for tmpSensor in tmpAllSensor['pureData']:
tmpSensor.stationId=0
session.delete(tmpStation)
session.commit()
ret=1
return ret
示例2: info
# 需要导入模块: from sensor import Sensor [as 别名]
# 或者: from sensor.Sensor import select [as 别名]
def info(inData):
from user import User
from sensor import Sensor
from station import Station
pureData=Auth.select(inData)
userInfo={}
sensorInfo={}
stationInfo={}
#print(pureData)
for tmp in pureData['data']:
t=tmp['sensorId']
if(not(t in sensorInfo)):
curSensor=Sensor.select({'id': t})
sensorInfo[t]=curSensor
tmp['sensorName']=sensorInfo[t]['data'][0]['name']
t=sensorInfo[t]['data'][0]['stationId']
if(not(t in stationInfo)):
curStation=Station.select({id: t})
stationInfo[t]=curStation
tmp['stationName']=stationInfo[t]['data'][0]['name']
t=tmp['userId']
if(not(t in userInfo)):
curUser=User.select({'id':t})
userInfo[t]=curUser
tmp['userName']=userInfo[t]['data'][0]['username']
return pureData
示例3: info
# 需要导入模块: from sensor import Sensor [as 别名]
# 或者: from sensor.Sensor import select [as 别名]
def info(inData):
from user import User
from sensor import Sensor
from station import Station
from auth import Auth
allEqpData=Eqp.select(inData)
userInfo={}
sensorInfo={}
stationInfo={}
authInfo={}
#print(allEqpData)
for tmp in allEqpData['data']:
t=tmp['number']
tmpAllSensor=Sensor.select({'number': t})
if(len(tmpAllSensor['data'])==0):
tmp['sensorName']='not find'
tmp['stationName']='not find'
tmp['username']='not find'
else:
curSensor=tmpAllSensor['pureData'][0]
tmp['sensorName']=curSensor.name
tmpAllStation=Station.select({'id': curSensor.stationId})
if(len(tmpAllStation['data'])==0):
tmp['stationName']='not find'
else:
curStation=tmpAllStation['pureData'][0]
tmp['stationName']=curStation.name
tmp['userName']=curStation.supervisor
tmpAllAuth=Auth.select({'sensorId': curSensor.id})
# if(len(tmpAllAuth['data'])==0):
# tmp['username']='not find'
# else:
# tmpAllUser=User.select({'id': tmpAllAuth['pureData'][0].userId})
# if(len(tmpAllUser['data'])==0):
# tmp['username']='not find'
# else:
# tmp['username']=tmpAllUser['data'][0]['username']
return allEqpData