You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2020/06/29 06:09:37 UTC
[incubator-iotdb] 01/01: fix insertRecord serialize in Python
example
This is an automated email from the ASF dual-hosted git repository.
hxd pushed a commit to branch update_rpc_protocol
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit cabd625b26afde06a38c05a109d9cd68040a7920
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Mon Jun 29 14:09:15 2020 +0800
fix insertRecord serialize in Python example
---
client-py/src/client_example.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/client-py/src/client_example.py b/client-py/src/client_example.py
index b20f372..9f27a2c 100755
--- a/client-py/src/client_example.py
+++ b/client-py/src/client_example.py
@@ -239,10 +239,10 @@ if __name__ == '__main__':
# insert a single row
values = [1, 11, 1.1, 11.1, True, "\'text0\'"]
- dataTypes = [TSDataType['INT32'], TSDataType['INT32'], TSDataType['FLOAT'],
+ dataTypes = [TSDataType['INT64'], TSDataType['INT32'], TSDataType['DOUBLE'],
TSDataType['FLOAT'], TSDataType['BOOLEAN'], TSDataType['TEXT']]
- value_pack_str = '>5ififibi7s'
+ value_pack_str = '>hqhihdhfh?hi' + str(len(values[5])) + 's'
encoding = 'utf-8'
valueByte = bytearray()
@@ -251,7 +251,7 @@ if __name__ == '__main__':
dataTypes[2], values[2],
dataTypes[3], values[3],
dataTypes[4], values[4],
- dataTypes[5], bytes(values[5], encoding)))
+ dataTypes[5], len(values[5]), bytes(values[5], encoding)))
timestamp = 1
status = client.insertRecord(TSInsertRecordReq(sessionId, deviceId, measurements, valueByte, timestamp))
@@ -262,8 +262,7 @@ if __name__ == '__main__':
times = bytearray()
rowCnt = 3
- dataTypes = [TSDataType['INT64'], TSDataType['INT32'], TSDataType['DOUBLE'],
- TSDataType['FLOAT'], TSDataType['BOOLEAN'], TSDataType['TEXT']]
+
# the first 3 belong to 's1', the second 3 belong to 's2'... the last 3
# belong to 's6'
# to transfer a string, you must first send its length and then its bytes