apache-iotdb 1.2.1__py3-none-any.whl → 1.3.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-iotdb
3
- Version: 1.2.1
3
+ Version: 1.3.2
4
4
  Summary: Apache IoTDB client API
5
5
  Home-page: https://github.com/apache/iotdb
6
6
  Author: Apache Software Foundation
@@ -13,12 +13,11 @@ Classifier: Topic :: Software Development :: Libraries
13
13
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
14
  Requires-Python: >=3.7
15
15
  Description-Content-Type: text/markdown
16
- Requires-Dist: thrift (>=0.13.0)
17
- Requires-Dist: pandas (<1.99.99,>=1.0.0)
18
- Requires-Dist: numpy (>=1.0.0)
19
- Requires-Dist: testcontainers (>=2.0.0)
20
- Requires-Dist: sqlalchemy (<1.5,>=1.4)
21
- Requires-Dist: sqlalchemy-utils (>=0.37.8)
16
+ Requires-Dist: thrift >=0.14.1
17
+ Requires-Dist: pandas >=1.3.5
18
+ Requires-Dist: numpy >=1.21.4
19
+ Requires-Dist: sqlalchemy <1.5,>=1.4
20
+ Requires-Dist: sqlalchemy-utils >=0.37.8
22
21
 
23
22
  <!--
24
23
 
@@ -334,12 +333,12 @@ session.execute_non_query_statement(sql)
334
333
  session.execute_statement(sql)
335
334
  ```
336
335
 
337
- ### Schema Template
338
- #### Create Schema Template
336
+ ### Device Template
337
+ #### Create Device Template
339
338
  The step for creating a metadata template is as follows
340
339
  1. Create the template class
341
340
  2. Adding child Node,InternalNode and MeasurementNode can be chose
342
- 3. Execute create schema template function
341
+ 3. Execute create device template function
343
342
 
344
343
  ```python
345
344
  template = Template(name=template_name, share_time=True)
@@ -357,7 +356,7 @@ template.add_template(m_node_x)
357
356
 
358
357
  session.create_schema_template(template)
359
358
  ```
360
- #### Modify Schema Template nodes
359
+ #### Modify Device Template nodes
361
360
  Modify nodes in a template, the template must be already created. These are functions that add or delete some measurement nodes.
362
361
  * add node in template
363
362
  ```python
@@ -369,18 +368,18 @@ session.add_measurements_in_template(template_name, measurements_path, data_type
369
368
  session.delete_node_in_template(template_name, path)
370
369
  ```
371
370
 
372
- #### Set Schema Template
371
+ #### Set Device Template
373
372
  ```python
374
373
  session.set_schema_template(template_name, prefix_path)
375
374
  ```
376
375
 
377
- #### Uset Schema Template
376
+ #### Uset Device Template
378
377
  ```python
379
378
  session.unset_schema_template(template_name, prefix_path)
380
379
  ```
381
380
 
382
- #### Show Schema Template
383
- * Show all schema templates
381
+ #### Show Device Template
382
+ * Show all device templates
384
383
  ```python
385
384
  session.show_all_templates()
386
385
  ```
@@ -399,22 +398,22 @@ session.count_measurements_in_template(template_name, path)
399
398
  session.is_path_exist_in_template(template_name, path)
400
399
  ```
401
400
 
402
- * Show nodes under in schema template
401
+ * Show nodes under in device template
403
402
  ```python
404
403
  session.show_measurements_in_template(template_name)
405
404
  ```
406
405
 
407
- * Show the path prefix where a schema template is set
406
+ * Show the path prefix where a device template is set
408
407
  ```python
409
408
  session.show_paths_template_set_on(template_name)
410
409
  ```
411
410
 
412
- * Show the path prefix where a schema template is used (i.e. the time series has been created)
411
+ * Show the path prefix where a device template is used (i.e. the time series has been created)
413
412
  ```python
414
413
  session.show_paths_template_using_on(template_name)
415
414
  ```
416
415
 
417
- #### Drop Schema Template
416
+ #### Drop Device Template
418
417
  Delete an existing metadata template,dropping an already set template is not supported
419
418
  ```python
420
419
  session.drop_schema_template("template_python")
@@ -1,6 +1,6 @@
1
- iotdb/IoTDBContainer.py,sha256=sowUmdGmptxXcuZ5tCXUalRi-ZWwErY5IDo5MQ07XxA,2098
2
- iotdb/Session.py,sha256=ovJu9eUeKwiL0tkypV1O5MCGsd9GVAD30MbVsM9fiw0,92207
3
- iotdb/SessionPool.py,sha256=tATl_UqxVkVC8GzRjNqfOKYgW9ceaHAofT1O4ZwwNKE,5207
1
+ iotdb/IoTDBContainer.py,sha256=gmGMEzacytqvrpCXGn0xrm3ab4LDyToNCHPEFg82Mwg,2514
2
+ iotdb/Session.py,sha256=CvIgzCtOE4TvrlraseS4xuDFrWScmauRnv_4Z0o3WMQ,89871
3
+ iotdb/SessionPool.py,sha256=To4o6oOacL8KEHJbU3G-1BtJywu__dUaAyFUh-t6ON8,5478
4
4
  iotdb/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
5
5
  iotdb/dbapi/Connection.py,sha256=t5CuwOTrMJxJ2YVxaEKi2fdaH9Vob-u7nQRCD_9vLcg,2569
6
6
  iotdb/dbapi/Cursor.py,sha256=CBFyHsk7cOxLJEwCWMJK0r4guXQ-OkNh39H54cyyH5k,9110
@@ -19,48 +19,48 @@ iotdb/sqlalchemy/tests/test_dialect.py,sha256=MdrJXqVpwRznppYvqC3OfVUOjR0sbMU5ub
19
19
  iotdb/template/InternalNode.py,sha256=jLFe_t4BG6Fq-ePD6u6_l8lox6syXDrXgH2S-xzDqiA,1417
20
20
  iotdb/template/MeasurementNode.py,sha256=bIBAXBFJqbmg4TOFMB8JbzuHTiBjRUew515kde2pWyM,2012
21
21
  iotdb/template/Template.py,sha256=p5ofgl0urb1eg6qfORR82ry5NbX_oeB8G9oLyvb1atk,3378
22
- iotdb/template/TemplateNode.py,sha256=m7j_0qnacoAax_a3rbZxCBAyJX9s4OHmUz4C3tFnqn0,1309
22
+ iotdb/template/TemplateNode.py,sha256=CxsaJlt65FDayRETADzdDZhMYDybOO6iURDheDFCFAw,1285
23
23
  iotdb/template/TemplateQueryType.py,sha256=6bNiydOiIqFnzutiuxdpWrOm-z9CkSawMCd_52EYh44,1272
24
24
  iotdb/template/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
25
25
  iotdb/thrift/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  iotdb/thrift/common/__init__.py,sha256=YFcZTT8Cm-6Y4oTiCaqq0DT1lw2W09WqoEc5_pTAwW0,34
27
27
  iotdb/thrift/common/constants.py,sha256=IKRM8SpfhYWXERWBgUbUhbdFpn363hmZjXDhEYnVRbw,366
28
- iotdb/thrift/common/ttypes.py,sha256=hvart3QYNnGOzIqB68Q1j0CZizi9kHNjQ6eIdppEU4g,67732
29
- iotdb/thrift/rpc/IClientRPCService.py,sha256=X_c5xImwPQKfmaYksX28VJUsz01RdyOxa_P-_aw_lHI,392401
28
+ iotdb/thrift/common/ttypes.py,sha256=EfE9QC6UmDoOZ42-mP6uLS-cISdt737cLE2cj0yOugM,75737
29
+ iotdb/thrift/rpc/IClientRPCService.py,sha256=C9CZxONUf14jJgAjrgOXfxwK3rfwfVrnCDnucwpDkwI,416186
30
30
  iotdb/thrift/rpc/__init__.py,sha256=69gRO2XxQu71SDeCRxiZFjK6Xw_61hdl5MdWceI-e1A,55
31
31
  iotdb/thrift/rpc/constants.py,sha256=IKRM8SpfhYWXERWBgUbUhbdFpn363hmZjXDhEYnVRbw,366
32
- iotdb/thrift/rpc/ttypes.py,sha256=-l_Q9yKevbD4hQxp-CpFOoZjdS0ghDnZFxGjRezPRAg,288179
32
+ iotdb/thrift/rpc/ttypes.py,sha256=s5k6EvfcaYa-9VeyyRDH0W7hZflDmCZkPGu83amSLxM,295368
33
33
  iotdb/tsfile/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
34
34
  iotdb/tsfile/common/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
35
- iotdb/tsfile/common/constant/TsFileConstant.py,sha256=jVzbxYy4j6HBP6mOIDnSIMrWgC_HrZoyDhkTwWfS-ak,1173
35
+ iotdb/tsfile/common/constant/TsFileConstant.py,sha256=uLSw9vnQZ6objfyhO3b9bHTip8yUW5aapPHEsXC0e7s,1165
36
36
  iotdb/tsfile/common/constant/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
37
37
  iotdb/tsfile/utils/Pair.py,sha256=91ecijUAlEiMRLlH2hjRi_mT_xWp6Vm-R3n4Z4USFqQ,952
38
- iotdb/tsfile/utils/ReadWriteIOUtils.py,sha256=x2dP8YtkKtzPIAbBGsyywXazM4d44hnhbpiQdvs2oDk,2953
38
+ iotdb/tsfile/utils/ReadWriteIOUtils.py,sha256=31CKH_1XWz8xc7DyInKaD-avkY-hVqNQILDb5PMucm4,2977
39
39
  iotdb/tsfile/utils/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
40
40
  iotdb/utils/BitMap.py,sha256=dGvruuvDJlT4KH7pIrkprZWsY_AG-P8HXe6JHBKDOpI,1436
41
- iotdb/utils/Field.py,sha256=7deJtFTPTlkHexmMUNtZDc-1Y9oWW4sk5Ts4KlAnXH4,6228
41
+ iotdb/utils/Field.py,sha256=VcbEsTVCCzthTcXuZK5lSLH6FKe8SgOKidSDotbhY8s,5910
42
42
  iotdb/utils/IoTDBConnectionException.py,sha256=D38r5MicwIdVsliCwtipICjx19wbvRI4ye0doAX7DPM,1179
43
- iotdb/utils/IoTDBConstants.py,sha256=eKqXRiwvU6pNlEW7wDv2Rg9Dm9mZ_iWCVUz4StH5bwk,2414
44
- iotdb/utils/IoTDBRpcDataSet.py,sha256=L0TFIphZ8vsPlo22J7j3QOQtmabSdaVpiCH-a18KPcA,16492
45
- iotdb/utils/NumpyTablet.py,sha256=629zT80aOlFM9ka2Sg7GbyN6GOO3CZ6O-8vSIWwShnM,6165
43
+ iotdb/utils/IoTDBConstants.py,sha256=u3ZevIqqKlL4NVU5LDGoB0YiZfhsYqkdYWKXfAXU7Tw,1717
44
+ iotdb/utils/IoTDBRpcDataSet.py,sha256=vKPuaXq-GL-jpeLQdaK2y__BQoeSvEu8sVv77op9Iuk,16482
45
+ iotdb/utils/NumpyTablet.py,sha256=HBlYmjE4Ohy5fimWvP9iex7Xte7LybDPjOHmYnwwVrc,6210
46
46
  iotdb/utils/RowRecord.py,sha256=-dQRu5YsPoFyDbEpdJdt5Eo-CvGleba9CcCPc7Nm3Vw,1750
47
- iotdb/utils/SessionDataSet.py,sha256=OguTEBa1VsM46TtOo65MddHDHcFQE3KhleRkKCpKEzU,6008
48
- iotdb/utils/Tablet.py,sha256=5g-SQ455orjGjYZIBstx9kiDockaT4gtNbMvoYWQsYs,8290
47
+ iotdb/utils/SessionDataSet.py,sha256=MabD9x9eLi23ytRqLmdpjOW7efrei76HDJBUuzK2Sks,5157
48
+ iotdb/utils/Tablet.py,sha256=4ADT4ZJYH9ijQM0OO7dcTMFWDh3oXIHG-Gl8OyQhkLQ,8169
49
49
  iotdb/utils/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
50
50
  tests/__init__.py,sha256=vGVFsdMOp1iKaCQl5rfYcPVa0FV94d-a7MsMDQDhHMc,789
51
51
  tests/tablet_performance_comparison.py,sha256=cjWV-RGhp73JjzITyKwC7Abx5IRGg00cLrS3cH3BkOo,10724
52
52
  tests/test_aligned_timeseries.py,sha256=hig7q7UEBEdYiQnCmW2uOUiVopBW9_WpUBWE8sWP8lk,9906
53
- tests/test_dataframe.py,sha256=0vBqIBBXwKpBnPNxmm_LGb0jfYkIG4gHB6DzS2QiBMQ,2807
53
+ tests/test_dataframe.py,sha256=c3ATEbljj6NKFhbOOAFZX-WC4saoNUFNVfLfic9ogf8,2808
54
54
  tests/test_delete_data.py,sha256=vDDNWJ_WUZihLOMdwRMyS4r9F6nm-SalVSx1hPXrDlE,5121
55
55
  tests/test_numpy_tablet.py,sha256=w3lLK8Cft7lGsCj_6Z1Y7kDshltN0osSDJb-EESi6_Y,7235
56
56
  tests/test_one_device.py,sha256=QW6t8GfH4FnYxZODYztpHEt8m3NAC-AUcs18KKK4q0w,4734
57
- tests/test_session.py,sha256=w8wb5GJwHNak3zgNpBFhk4Wu0qhNybYoJT3SqV-zi10,14333
58
- tests/test_session_pool.py,sha256=z_72wX2eWuoJrBsdJkF5PfKFz2tcOky6GelkwEWgQjg,3627
59
- tests/test_tablet.py,sha256=0lAqY3BrHO3V73Zbk_kZL8PQVHkyTIJ0JKUMpBRtZl8,4194
60
- tests/test_template.py,sha256=E0BsWSB_cYSk5HIJuOyASLYoe4J2Wh41veZAeX2Ov_c,4021
57
+ tests/test_session.py,sha256=aLhjUxZJ1IX2DBPuh3h7E4vfJs2jTnBa4dSIDgnMLIo,14343
58
+ tests/test_session_pool.py,sha256=v4cbLLwob8JTG0vEV1zhr_YCHM7649JacBOg2Svcemo,3891
59
+ tests/test_tablet.py,sha256=m0jLWJPQpy0K8sgOMS-91MaIL8QnwI3u4SWHjcEWbDI,4438
60
+ tests/test_template.py,sha256=oN4vL6qvF89NG3vw_kj77RgH2DZVVizQX52AMBWOmCE,4021
61
61
  tests/test_todf.py,sha256=DPqapHpwjgits_y3OI3fU1mw7JHa8sUMg_-ViJ6NeYg,8071
62
- apache_iotdb-1.2.1.dist-info/METADATA,sha256=i3gKpH2DsOVA9w2iRgOig6F1Y_wvBqEWfVLgYqnuHik,21540
63
- apache_iotdb-1.2.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
64
- apache_iotdb-1.2.1.dist-info/entry_points.txt,sha256=BmQWy6NHyWXorQcVm8-VWpt9MSqe46UFyV2hnsl4yok,73
65
- apache_iotdb-1.2.1.dist-info/top_level.txt,sha256=B9jGGOaAAqF1WrWw2jX2K-naWAZn2nhyrL-6hM1qwyM,12
66
- apache_iotdb-1.2.1.dist-info/RECORD,,
62
+ apache_iotdb-1.3.2.dist-info/METADATA,sha256=cqbP9uBdjETc3PFqZj88YKXf75kMsRqdxl3oPE-2lwI,21482
63
+ apache_iotdb-1.3.2.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
64
+ apache_iotdb-1.3.2.dist-info/entry_points.txt,sha256=BmQWy6NHyWXorQcVm8-VWpt9MSqe46UFyV2hnsl4yok,73
65
+ apache_iotdb-1.3.2.dist-info/top_level.txt,sha256=B9jGGOaAAqF1WrWw2jX2K-naWAZn2nhyrL-6hM1qwyM,12
66
+ apache_iotdb-1.3.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.38.4)
2
+ Generator: setuptools (70.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
iotdb/IoTDBContainer.py CHANGED
@@ -20,6 +20,7 @@ import time
20
20
  from os import environ
21
21
 
22
22
  from testcontainers.core.container import DockerContainer
23
+ from testcontainers.core.exceptions import ContainerStartException
23
24
  from testcontainers.core.utils import setup_logger
24
25
  from testcontainers.core.waiting_utils import wait_container_is_ready
25
26
 
@@ -41,6 +42,13 @@ class IoTDBContainer(DockerContainer):
41
42
  self.get_container_host_ip(), self.get_exposed_port(6667), "root", "root"
42
43
  )
43
44
  session.open(False)
45
+ with session.execute_statement("SHOW CLUSTER") as session_data_set:
46
+ while session_data_set.has_next():
47
+ if (
48
+ session_data_set.next().get_fields()[2].get_string_value()
49
+ != "Running"
50
+ ):
51
+ raise ContainerStartException("IoTDB is not started")
44
52
  session.close()
45
53
 
46
54
  def __init__(self, image="apache/iotdb:latest", **kwargs):
iotdb/Session.py CHANGED
@@ -59,8 +59,6 @@ from .thrift.rpc.ttypes import (
59
59
  )
60
60
  from .utils.IoTDBConnectionException import IoTDBConnectionException
61
61
 
62
- from .utils.IoTDBConstants import TSDataType
63
-
64
62
  logger = logging.getLogger("IoTDB")
65
63
 
66
64
 
@@ -176,9 +174,9 @@ class Session(object):
176
174
  raise IoTDBConnectionException(e) from None
177
175
 
178
176
  if self.__enable_rpc_compression:
179
- client = Client(TCompactProtocol.TCompactProtocol(transport))
177
+ client = Client(TCompactProtocol.TCompactProtocolAccelerated(transport))
180
178
  else:
181
- client = Client(TBinaryProtocol.TBinaryProtocol(transport))
179
+ client = Client(TBinaryProtocol.TBinaryProtocolAccelerated(transport))
182
180
 
183
181
  open_req = TSOpenSessionReq(
184
182
  client_protocol=self.protocol_version,
@@ -310,9 +308,6 @@ class Session(object):
310
308
  :param attributes: Dictionary, attribute map for time series
311
309
  :param alias: String, measurement alias for time series
312
310
  """
313
- data_type = data_type.value
314
- encoding = encoding.value
315
- compressor = compressor.value
316
311
  request = TSCreateTimeseriesReq(
317
312
  self.__session_id,
318
313
  ts_path,
@@ -349,9 +344,6 @@ class Session(object):
349
344
  :param encoding_lst: List of TSEncoding, encodings for time series
350
345
  :param compressor_lst: List of Compressor, compressing types for time series
351
346
  """
352
- data_type_lst = [data_type.value for data_type in data_type_lst]
353
- encoding_lst = [encoding.value for encoding in encoding_lst]
354
- compressor_lst = [compressor.value for compressor in compressor_lst]
355
347
 
356
348
  request = TSCreateAlignedTimeseriesReq(
357
349
  self.__session_id,
@@ -399,9 +391,6 @@ class Session(object):
399
391
  :param attributes_lst: List of attribute Dictionary, attribute maps for time series
400
392
  :param alias_lst: List of alias, measurement alias for time series
401
393
  """
402
- data_type_lst = [data_type.value for data_type in data_type_lst]
403
- encoding_lst = [encoding.value for encoding in encoding_lst]
404
- compressor_lst = [compressor.value for compressor in compressor_lst]
405
394
 
406
395
  request = TSCreateMultiTimeseriesReq(
407
396
  self.__session_id,
@@ -572,7 +561,6 @@ class Session(object):
572
561
  :param data_types: List of TSDataType, indicate the data type for each sensor
573
562
  :param values: List, values to be inserted, for each sensor
574
563
  """
575
- data_types = [data_type.value for data_type in data_types]
576
564
  request = self.gen_insert_record_req(
577
565
  device_id, timestamp, measurements, data_types, values
578
566
  )
@@ -606,10 +594,6 @@ class Session(object):
606
594
  :param types_lst: 2-D List of TSDataType, each element of outer list indicates sensor data types of a device
607
595
  :param values_lst: 2-D List, values to be inserted, for each device
608
596
  """
609
- type_values_lst = []
610
- for types in types_lst:
611
- data_types = [data_type.value for data_type in types]
612
- type_values_lst.append(data_types)
613
597
  if self.__enable_redirection:
614
598
  request_group = {}
615
599
  for i in range(len(device_ids)):
@@ -622,7 +606,7 @@ class Session(object):
622
606
  request.timestamps.append(times[i])
623
607
  request.measurementsList.append(measurements_lst[i])
624
608
  request.valuesList.append(
625
- Session.value_to_bytes(type_values_lst[i], values_lst[i])
609
+ Session.value_to_bytes(types_lst[i], values_lst[i])
626
610
  )
627
611
  for client, request in request_group.items():
628
612
  try:
@@ -647,7 +631,7 @@ class Session(object):
647
631
  return 0
648
632
  else:
649
633
  request = self.gen_insert_records_req(
650
- device_ids, times, measurements_lst, type_values_lst, values_lst
634
+ device_ids, times, measurements_lst, types_lst, values_lst
651
635
  )
652
636
  try:
653
637
  return Session.verify_success(self.__client.insertRecords(request))
@@ -679,7 +663,6 @@ class Session(object):
679
663
  :param data_types: List of TSDataType, indicate the data type for each sensor
680
664
  :param values: List, values to be inserted, for each sensor
681
665
  """
682
- data_types = [data_type.value for data_type in data_types]
683
666
  request = self.gen_insert_record_req(
684
667
  device_id, timestamp, measurements, data_types, values, True
685
668
  )
@@ -713,10 +696,6 @@ class Session(object):
713
696
  :param types_lst: 2-D List of TSDataType, each element of outer list indicates sensor data types of a device
714
697
  :param values_lst: 2-D List, values to be inserted, for each device
715
698
  """
716
- type_values_lst = []
717
- for types in types_lst:
718
- data_types = [data_type.value for data_type in types]
719
- type_values_lst.append(data_types)
720
699
  if self.__enable_redirection:
721
700
  request_group = {}
722
701
  for i in range(len(device_ids)):
@@ -729,7 +708,7 @@ class Session(object):
729
708
  request.timestamps.append(times[i])
730
709
  request.measurementsList.append(measurements_lst[i])
731
710
  request.valuesList.append(
732
- Session.value_to_bytes(type_values_lst[i], values_lst[i])
711
+ Session.value_to_bytes(types_lst[i], values_lst[i])
733
712
  )
734
713
  for client, request in request_group.items():
735
714
  try:
@@ -754,7 +733,7 @@ class Session(object):
754
733
  return 0
755
734
  else:
756
735
  request = self.gen_insert_records_req(
757
- device_ids, times, measurements_lst, type_values_lst, values_lst, True
736
+ device_ids, times, measurements_lst, types_lst, values_lst, True
758
737
  )
759
738
  try:
760
739
  return Session.verify_success(self.__client.insertRecords(request))
@@ -784,7 +763,6 @@ class Session(object):
784
763
  :param data_types: List of TSDataType, indicate the data type for each sensor
785
764
  :param values: List, values to be inserted, for each sensor
786
765
  """
787
- data_types = [data_type.value for data_type in data_types]
788
766
  request = self.gen_insert_record_req(
789
767
  device_id, timestamp, measurements, data_types, values
790
768
  )
@@ -813,12 +791,8 @@ class Session(object):
813
791
  :param types_lst: 2-D List of TSDataType, each element of outer list indicates sensor data types of a device
814
792
  :param values_lst: 2-D List, values to be inserted, for each device
815
793
  """
816
- type_values_lst = []
817
- for types in types_lst:
818
- data_types = [data_type.value for data_type in types]
819
- type_values_lst.append(data_types)
820
794
  request = self.gen_insert_records_req(
821
- device_ids, times, measurements_lst, type_values_lst, values_lst
795
+ device_ids, times, measurements_lst, types_lst, values_lst
822
796
  )
823
797
  try:
824
798
  return Session.verify_success(self.__client.testInsertRecords(request))
@@ -951,10 +925,7 @@ class Session(object):
951
925
  request.measurementsList.append(tablet_lst[i].get_measurements())
952
926
  request.valuesList.append(tablet_lst[i].get_binary_values())
953
927
  request.sizeList.append(tablet_lst[i].get_row_number())
954
- data_type_values = [
955
- data_type.value for data_type in tablet_lst[i].get_data_types()
956
- ]
957
- request.typesList.append(data_type_values)
928
+ request.typesList.append(tablet_lst[i].get_data_types())
958
929
  for client, request in request_group.items():
959
930
  try:
960
931
  Session.verify_success_with_redirection_for_multi_devices(
@@ -1045,10 +1016,7 @@ class Session(object):
1045
1016
  request.measurementsList.append(tablet_lst[i].get_measurements())
1046
1017
  request.valuesList.append(tablet_lst[i].get_binary_values())
1047
1018
  request.sizeList.append(tablet_lst[i].get_row_number())
1048
- data_type_values = [
1049
- data_type.value for data_type in tablet_lst[i].get_data_types()
1050
- ]
1051
- request.typesList.append(data_type_values)
1019
+ request.typesList.append(tablet_lst[i].get_data_types())
1052
1020
  for client, request in request_group.items():
1053
1021
  try:
1054
1022
  Session.verify_success_with_redirection_for_multi_devices(
@@ -1243,7 +1211,6 @@ class Session(object):
1243
1211
  for values, data_types, measurements in zip(
1244
1212
  values_list, types_list, measurements_list
1245
1213
  ):
1246
- data_types = [data_type.value for data_type in data_types]
1247
1214
  if (len(values) != len(data_types)) or (len(values) != len(measurements)):
1248
1215
  raise RuntimeError(
1249
1216
  "insert records of one device error: deviceIds, times, measurementsList and valuesList's size should be equal"
@@ -1303,14 +1270,13 @@ class Session(object):
1303
1270
  raise IoTDBConnectionException(self.connection_error_msg()) from None
1304
1271
 
1305
1272
  def gen_insert_tablet_req(self, tablet, is_aligned=False):
1306
- data_type_values = [data_type.value for data_type in tablet.get_data_types()]
1307
1273
  return TSInsertTabletReq(
1308
1274
  self.__session_id,
1309
1275
  tablet.get_device_id(),
1310
1276
  tablet.get_measurements(),
1311
1277
  tablet.get_binary_values(),
1312
1278
  tablet.get_binary_timestamps(),
1313
- data_type_values,
1279
+ tablet.get_data_types(),
1314
1280
  tablet.get_row_number(),
1315
1281
  is_aligned,
1316
1282
  )
@@ -1323,14 +1289,11 @@ class Session(object):
1323
1289
  type_lst = []
1324
1290
  size_lst = []
1325
1291
  for tablet in tablet_lst:
1326
- data_type_values = [
1327
- data_type.value for data_type in tablet.get_data_types()
1328
- ]
1329
1292
  device_id_lst.append(tablet.get_device_id())
1330
1293
  measurements_lst.append(tablet.get_measurements())
1331
1294
  values_lst.append(tablet.get_binary_values())
1332
1295
  timestamps_lst.append(tablet.get_binary_timestamps())
1333
- type_lst.append(data_type_values)
1296
+ type_lst.append(tablet.get_data_types())
1334
1297
  size_lst.append(tablet.get_row_number())
1335
1298
  return TSInsertTabletsReq(
1336
1299
  self.__session_id,
@@ -1440,41 +1403,41 @@ class Session(object):
1440
1403
  format_str_list = [">"]
1441
1404
  values_tobe_packed = []
1442
1405
  for data_type, value in zip(data_types, values):
1443
- if data_type == TSDataType.BOOLEAN.value:
1444
- format_str_list.append("c")
1445
- format_str_list.append("?")
1446
- values_tobe_packed.append(bytes([TSDataType.BOOLEAN.value]))
1406
+ # BOOLEAN
1407
+ if data_type == 0:
1408
+ format_str_list.append("c?")
1409
+ values_tobe_packed.append(b"\x00")
1447
1410
  values_tobe_packed.append(value)
1448
- elif data_type == TSDataType.INT32.value:
1449
- format_str_list.append("c")
1450
- format_str_list.append("i")
1451
- values_tobe_packed.append(bytes([TSDataType.INT32.value]))
1411
+ # INT32
1412
+ elif data_type == 1:
1413
+ format_str_list.append("ci")
1414
+ values_tobe_packed.append(b"\x01")
1452
1415
  values_tobe_packed.append(value)
1453
- elif data_type == TSDataType.INT64.value:
1454
- format_str_list.append("c")
1455
- format_str_list.append("q")
1456
- values_tobe_packed.append(bytes([TSDataType.INT64.value]))
1416
+ # INT64
1417
+ elif data_type == 2:
1418
+ format_str_list.append("cq")
1419
+ values_tobe_packed.append(b"\x02")
1457
1420
  values_tobe_packed.append(value)
1458
- elif data_type == TSDataType.FLOAT.value:
1459
- format_str_list.append("c")
1460
- format_str_list.append("f")
1461
- values_tobe_packed.append(bytes([TSDataType.FLOAT.value]))
1421
+ # FLOAT
1422
+ elif data_type == 3:
1423
+ format_str_list.append("cf")
1424
+ values_tobe_packed.append(b"\x03")
1462
1425
  values_tobe_packed.append(value)
1463
- elif data_type == TSDataType.DOUBLE.value:
1464
- format_str_list.append("c")
1465
- format_str_list.append("d")
1466
- values_tobe_packed.append(bytes([TSDataType.DOUBLE.value]))
1426
+ # DOUBLE
1427
+ elif data_type == 4:
1428
+ format_str_list.append("cd")
1429
+ values_tobe_packed.append(b"\x04")
1467
1430
  values_tobe_packed.append(value)
1468
- elif data_type == TSDataType.TEXT.value:
1431
+ # TEXT
1432
+ elif data_type == 5:
1469
1433
  if isinstance(value, str):
1470
1434
  value_bytes = bytes(value, "utf-8")
1471
1435
  else:
1472
1436
  value_bytes = value
1473
- format_str_list.append("c")
1474
- format_str_list.append("i")
1437
+ format_str_list.append("ci")
1475
1438
  format_str_list.append(str(len(value_bytes)))
1476
1439
  format_str_list.append("s")
1477
- values_tobe_packed.append(bytes([TSDataType.TEXT.value]))
1440
+ values_tobe_packed.append(b"\x05")
1478
1441
  values_tobe_packed.append(len(value_bytes))
1479
1442
  values_tobe_packed.append(value_bytes)
1480
1443
  else:
@@ -1848,7 +1811,7 @@ class Session(object):
1848
1811
 
1849
1812
  def create_schema_template(self, template: Template):
1850
1813
  """
1851
- create schema template, users using this method should use the template class as an argument
1814
+ create device template, users using this method should use the template class as an argument
1852
1815
  :param template: The template contains multiple child node(see Template.py)
1853
1816
  """
1854
1817
  bytes_array = template.serialize
@@ -1871,7 +1834,7 @@ class Session(object):
1871
1834
 
1872
1835
  def drop_schema_template(self, template_name: str):
1873
1836
  """
1874
- drop schema template, this method should be used to the template unset anything
1837
+ drop device template, this method should be used to the template unset anything
1875
1838
  :param template_name: template name
1876
1839
  """
1877
1840
  request = TSDropSchemaTemplateReq(self.__session_id, template_name)
@@ -1913,9 +1876,9 @@ class Session(object):
1913
1876
  template_name,
1914
1877
  is_aligned,
1915
1878
  measurements_path,
1916
- list(map(lambda x: x.value, data_types)),
1917
- list(map(lambda x: x.value, encodings)),
1918
- list(map(lambda x: x.value, compressors)),
1879
+ data_types,
1880
+ encodings,
1881
+ compressors,
1919
1882
  )
1920
1883
  try:
1921
1884
  return Session.verify_success(self.__client.appendSchemaTemplate(request))
@@ -1975,7 +1938,7 @@ class Session(object):
1975
1938
 
1976
1939
  def unset_schema_template(self, template_name, prefix_path):
1977
1940
  """
1978
- unset schema template from prefix path, this method unsetting the template from entities,
1941
+ unset device template from prefix path, this method unsetting the template from entities,
1979
1942
  which have already inserted records using the template, is not supported.
1980
1943
  :param template_name: template name
1981
1944
  :param prefix_path:
@@ -1999,7 +1962,7 @@ class Session(object):
1999
1962
 
2000
1963
  def count_measurements_in_template(self, template_name: str):
2001
1964
  """
2002
- drop schema template, this method should be used to the template unset anything
1965
+ drop device template, this method should be used to the template unset anything
2003
1966
  :param template_name: template name
2004
1967
  """
2005
1968
  request = TSQueryTemplateReq(
@@ -2105,7 +2068,7 @@ class Session(object):
2105
2068
 
2106
2069
  def show_all_templates(self):
2107
2070
  """
2108
- show all schema templates
2071
+ show all device templates
2109
2072
  """
2110
2073
  request = TSQueryTemplateReq(
2111
2074
  self.__session_id,
@@ -2130,7 +2093,7 @@ class Session(object):
2130
2093
 
2131
2094
  def show_paths_template_set_on(self, template_name):
2132
2095
  """
2133
- show the path prefix where a schema template is set
2096
+ show the path prefix where a device template is set
2134
2097
  :param template_name:
2135
2098
  """
2136
2099
  request = TSQueryTemplateReq(
@@ -2154,7 +2117,7 @@ class Session(object):
2154
2117
 
2155
2118
  def show_paths_template_using_on(self, template_name):
2156
2119
  """
2157
- show the path prefix where a schema template is used
2120
+ show the path prefix where a device template is used
2158
2121
  :param template_name:
2159
2122
  """
2160
2123
  request = TSQueryTemplateReq(