-
Notifications
You must be signed in to change notification settings - Fork 0
/
iotdb_bytes.py
37 lines (29 loc) · 1.1 KB
/
iotdb_bytes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from manager.iotdb_manager import IoTDBManager
from model.status import Status
if __name__ == '__main__':
# create session with IoTDB
iotdb = IoTDBManager('127.0.0.1', 6667, 'root', 'root')
'''
get data by `bytes_getter` method
'''
print('===================== get data by `bytes_getter` method =====================')
# get bytes data from IoTDB
bytes_data = iotdb.bytes_getter('root.star.computer')
# do something to send data
# parse data on the ground
if bytes_data != b'00000000':
print('data size: ', len(bytes_data))
print(Status(bytes_data))
'''
get data by `bytes_generator` iterator
'''
print('===================== get data by `bytes_generator` iterator =====================')
generator = iotdb.bytes_generator('root.star.computer')
for i in range(0, 10):
bytes_data = generator.__next__()
# do something to send data
# parse data on the ground
if bytes_data != b'00000000':
print('data size: ', len(bytes_data))
print(Status(bytes_data))
iotdb.close_session()