You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# check which argument is passed and return data respectively
st = sys.argv[1] # sensor type
id = sys.argv[2] # sensor id
c.execute("SELECT ({sv}) FROM {tn} WHERE {node_id}='{id}' AND {s_type}='{st}'".format(sv='sensor_value', s_type='sensor_type', st=st, tn=tn, node_id='node_id',id=id))
#c.execute("SELECT DISTINCT node_id FROM {tn}".format(tn=tn))
data = c.fetchone() #returns one matching row; fetchall() returns all matching rows
#ids = c.fetchall()
#print (ids)
#print(ids[2][0])
print (data[0])
# d = {}
# for i in ids:
# d[i[0]] = []
# c.execute("SELECT DISTINCT sensor_type FROM {tn} WHERE {nodeid} = {id}".format(nodeid='node_id',tn=tn, id=i[0]))