apache-iotdb 1.2.1__tar.gz → 1.3.2__tar.gz
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.
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/PKG-INFO +18 -13
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/README.md +12 -12
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/apache_iotdb.egg-info/PKG-INFO +18 -13
- apache_iotdb-1.3.2/apache_iotdb.egg-info/requires.txt +5 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/IoTDBContainer.py +8 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/Session.py +45 -82
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/SessionPool.py +44 -16
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/template/TemplateNode.py +4 -7
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/thrift/common/ttypes.py +230 -37
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/thrift/rpc/IClientRPCService.py +773 -75
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/thrift/rpc/ttypes.py +213 -7
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/tsfile/common/constant/TsFileConstant.py +1 -2
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/tsfile/utils/ReadWriteIOUtils.py +6 -6
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/Field.py +77 -71
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/IoTDBConstants.py +4 -29
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/IoTDBRpcDataSet.py +154 -155
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/NumpyTablet.py +5 -3
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/SessionDataSet.py +39 -51
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/Tablet.py +7 -7
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/setup.py +4 -5
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_dataframe.py +1 -1
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_session.py +34 -26
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_session_pool.py +27 -6
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_tablet.py +11 -7
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_template.py +2 -2
- apache-iotdb-1.2.1/apache_iotdb.egg-info/requires.txt +0 -6
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/apache_iotdb.egg-info/SOURCES.txt +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/apache_iotdb.egg-info/dependency_links.txt +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/apache_iotdb.egg-info/entry_points.txt +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/apache_iotdb.egg-info/top_level.txt +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/dbapi/Connection.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/dbapi/Cursor.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/dbapi/Exceptions.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/dbapi/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/dbapi/tests/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/dbapi/tests/test_connection.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/dbapi/tests/test_cursor.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/sqlalchemy/IoTDBDialect.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/sqlalchemy/IoTDBIdentifierPreparer.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/sqlalchemy/IoTDBSQLCompiler.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/sqlalchemy/IoTDBTypeCompiler.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/sqlalchemy/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/sqlalchemy/tests/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/sqlalchemy/tests/test_dialect.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/template/InternalNode.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/template/MeasurementNode.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/template/Template.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/template/TemplateQueryType.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/template/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/thrift/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/thrift/common/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/thrift/common/constants.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/thrift/rpc/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/thrift/rpc/constants.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/tsfile/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/tsfile/common/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/tsfile/common/constant/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/tsfile/utils/Pair.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/tsfile/utils/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/BitMap.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/IoTDBConnectionException.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/RowRecord.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/iotdb/utils/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/pyproject.toml +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/setup.cfg +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/__init__.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/tablet_performance_comparison.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_aligned_timeseries.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_delete_data.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_numpy_tablet.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_one_device.py +0 -0
- {apache-iotdb-1.2.1 → apache_iotdb-1.3.2}/tests/test_todf.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-iotdb
|
|
3
|
-
Version: 1.2
|
|
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,6 +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.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
|
|
16
21
|
|
|
17
22
|
<!--
|
|
18
23
|
|
|
@@ -328,12 +333,12 @@ session.execute_non_query_statement(sql)
|
|
|
328
333
|
session.execute_statement(sql)
|
|
329
334
|
```
|
|
330
335
|
|
|
331
|
-
###
|
|
332
|
-
#### Create
|
|
336
|
+
### Device Template
|
|
337
|
+
#### Create Device Template
|
|
333
338
|
The step for creating a metadata template is as follows
|
|
334
339
|
1. Create the template class
|
|
335
340
|
2. Adding child Node,InternalNode and MeasurementNode can be chose
|
|
336
|
-
3. Execute create
|
|
341
|
+
3. Execute create device template function
|
|
337
342
|
|
|
338
343
|
```python
|
|
339
344
|
template = Template(name=template_name, share_time=True)
|
|
@@ -351,7 +356,7 @@ template.add_template(m_node_x)
|
|
|
351
356
|
|
|
352
357
|
session.create_schema_template(template)
|
|
353
358
|
```
|
|
354
|
-
#### Modify
|
|
359
|
+
#### Modify Device Template nodes
|
|
355
360
|
Modify nodes in a template, the template must be already created. These are functions that add or delete some measurement nodes.
|
|
356
361
|
* add node in template
|
|
357
362
|
```python
|
|
@@ -363,18 +368,18 @@ session.add_measurements_in_template(template_name, measurements_path, data_type
|
|
|
363
368
|
session.delete_node_in_template(template_name, path)
|
|
364
369
|
```
|
|
365
370
|
|
|
366
|
-
#### Set
|
|
371
|
+
#### Set Device Template
|
|
367
372
|
```python
|
|
368
373
|
session.set_schema_template(template_name, prefix_path)
|
|
369
374
|
```
|
|
370
375
|
|
|
371
|
-
#### Uset
|
|
376
|
+
#### Uset Device Template
|
|
372
377
|
```python
|
|
373
378
|
session.unset_schema_template(template_name, prefix_path)
|
|
374
379
|
```
|
|
375
380
|
|
|
376
|
-
#### Show
|
|
377
|
-
* Show all
|
|
381
|
+
#### Show Device Template
|
|
382
|
+
* Show all device templates
|
|
378
383
|
```python
|
|
379
384
|
session.show_all_templates()
|
|
380
385
|
```
|
|
@@ -393,22 +398,22 @@ session.count_measurements_in_template(template_name, path)
|
|
|
393
398
|
session.is_path_exist_in_template(template_name, path)
|
|
394
399
|
```
|
|
395
400
|
|
|
396
|
-
* Show nodes under in
|
|
401
|
+
* Show nodes under in device template
|
|
397
402
|
```python
|
|
398
403
|
session.show_measurements_in_template(template_name)
|
|
399
404
|
```
|
|
400
405
|
|
|
401
|
-
* Show the path prefix where a
|
|
406
|
+
* Show the path prefix where a device template is set
|
|
402
407
|
```python
|
|
403
408
|
session.show_paths_template_set_on(template_name)
|
|
404
409
|
```
|
|
405
410
|
|
|
406
|
-
* Show the path prefix where a
|
|
411
|
+
* Show the path prefix where a device template is used (i.e. the time series has been created)
|
|
407
412
|
```python
|
|
408
413
|
session.show_paths_template_using_on(template_name)
|
|
409
414
|
```
|
|
410
415
|
|
|
411
|
-
#### Drop
|
|
416
|
+
#### Drop Device Template
|
|
412
417
|
Delete an existing metadata template,dropping an already set template is not supported
|
|
413
418
|
```python
|
|
414
419
|
session.drop_schema_template("template_python")
|
|
@@ -312,12 +312,12 @@ session.execute_non_query_statement(sql)
|
|
|
312
312
|
session.execute_statement(sql)
|
|
313
313
|
```
|
|
314
314
|
|
|
315
|
-
###
|
|
316
|
-
#### Create
|
|
315
|
+
### Device Template
|
|
316
|
+
#### Create Device Template
|
|
317
317
|
The step for creating a metadata template is as follows
|
|
318
318
|
1. Create the template class
|
|
319
319
|
2. Adding child Node,InternalNode and MeasurementNode can be chose
|
|
320
|
-
3. Execute create
|
|
320
|
+
3. Execute create device template function
|
|
321
321
|
|
|
322
322
|
```python
|
|
323
323
|
template = Template(name=template_name, share_time=True)
|
|
@@ -335,7 +335,7 @@ template.add_template(m_node_x)
|
|
|
335
335
|
|
|
336
336
|
session.create_schema_template(template)
|
|
337
337
|
```
|
|
338
|
-
#### Modify
|
|
338
|
+
#### Modify Device Template nodes
|
|
339
339
|
Modify nodes in a template, the template must be already created. These are functions that add or delete some measurement nodes.
|
|
340
340
|
* add node in template
|
|
341
341
|
```python
|
|
@@ -347,18 +347,18 @@ session.add_measurements_in_template(template_name, measurements_path, data_type
|
|
|
347
347
|
session.delete_node_in_template(template_name, path)
|
|
348
348
|
```
|
|
349
349
|
|
|
350
|
-
#### Set
|
|
350
|
+
#### Set Device Template
|
|
351
351
|
```python
|
|
352
352
|
session.set_schema_template(template_name, prefix_path)
|
|
353
353
|
```
|
|
354
354
|
|
|
355
|
-
#### Uset
|
|
355
|
+
#### Uset Device Template
|
|
356
356
|
```python
|
|
357
357
|
session.unset_schema_template(template_name, prefix_path)
|
|
358
358
|
```
|
|
359
359
|
|
|
360
|
-
#### Show
|
|
361
|
-
* Show all
|
|
360
|
+
#### Show Device Template
|
|
361
|
+
* Show all device templates
|
|
362
362
|
```python
|
|
363
363
|
session.show_all_templates()
|
|
364
364
|
```
|
|
@@ -377,22 +377,22 @@ session.count_measurements_in_template(template_name, path)
|
|
|
377
377
|
session.is_path_exist_in_template(template_name, path)
|
|
378
378
|
```
|
|
379
379
|
|
|
380
|
-
* Show nodes under in
|
|
380
|
+
* Show nodes under in device template
|
|
381
381
|
```python
|
|
382
382
|
session.show_measurements_in_template(template_name)
|
|
383
383
|
```
|
|
384
384
|
|
|
385
|
-
* Show the path prefix where a
|
|
385
|
+
* Show the path prefix where a device template is set
|
|
386
386
|
```python
|
|
387
387
|
session.show_paths_template_set_on(template_name)
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
* Show the path prefix where a
|
|
390
|
+
* Show the path prefix where a device template is used (i.e. the time series has been created)
|
|
391
391
|
```python
|
|
392
392
|
session.show_paths_template_using_on(template_name)
|
|
393
393
|
```
|
|
394
394
|
|
|
395
|
-
#### Drop
|
|
395
|
+
#### Drop Device Template
|
|
396
396
|
Delete an existing metadata template,dropping an already set template is not supported
|
|
397
397
|
```python
|
|
398
398
|
session.drop_schema_template("template_python")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-iotdb
|
|
3
|
-
Version: 1.2
|
|
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,6 +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.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
|
|
16
21
|
|
|
17
22
|
<!--
|
|
18
23
|
|
|
@@ -328,12 +333,12 @@ session.execute_non_query_statement(sql)
|
|
|
328
333
|
session.execute_statement(sql)
|
|
329
334
|
```
|
|
330
335
|
|
|
331
|
-
###
|
|
332
|
-
#### Create
|
|
336
|
+
### Device Template
|
|
337
|
+
#### Create Device Template
|
|
333
338
|
The step for creating a metadata template is as follows
|
|
334
339
|
1. Create the template class
|
|
335
340
|
2. Adding child Node,InternalNode and MeasurementNode can be chose
|
|
336
|
-
3. Execute create
|
|
341
|
+
3. Execute create device template function
|
|
337
342
|
|
|
338
343
|
```python
|
|
339
344
|
template = Template(name=template_name, share_time=True)
|
|
@@ -351,7 +356,7 @@ template.add_template(m_node_x)
|
|
|
351
356
|
|
|
352
357
|
session.create_schema_template(template)
|
|
353
358
|
```
|
|
354
|
-
#### Modify
|
|
359
|
+
#### Modify Device Template nodes
|
|
355
360
|
Modify nodes in a template, the template must be already created. These are functions that add or delete some measurement nodes.
|
|
356
361
|
* add node in template
|
|
357
362
|
```python
|
|
@@ -363,18 +368,18 @@ session.add_measurements_in_template(template_name, measurements_path, data_type
|
|
|
363
368
|
session.delete_node_in_template(template_name, path)
|
|
364
369
|
```
|
|
365
370
|
|
|
366
|
-
#### Set
|
|
371
|
+
#### Set Device Template
|
|
367
372
|
```python
|
|
368
373
|
session.set_schema_template(template_name, prefix_path)
|
|
369
374
|
```
|
|
370
375
|
|
|
371
|
-
#### Uset
|
|
376
|
+
#### Uset Device Template
|
|
372
377
|
```python
|
|
373
378
|
session.unset_schema_template(template_name, prefix_path)
|
|
374
379
|
```
|
|
375
380
|
|
|
376
|
-
#### Show
|
|
377
|
-
* Show all
|
|
381
|
+
#### Show Device Template
|
|
382
|
+
* Show all device templates
|
|
378
383
|
```python
|
|
379
384
|
session.show_all_templates()
|
|
380
385
|
```
|
|
@@ -393,22 +398,22 @@ session.count_measurements_in_template(template_name, path)
|
|
|
393
398
|
session.is_path_exist_in_template(template_name, path)
|
|
394
399
|
```
|
|
395
400
|
|
|
396
|
-
* Show nodes under in
|
|
401
|
+
* Show nodes under in device template
|
|
397
402
|
```python
|
|
398
403
|
session.show_measurements_in_template(template_name)
|
|
399
404
|
```
|
|
400
405
|
|
|
401
|
-
* Show the path prefix where a
|
|
406
|
+
* Show the path prefix where a device template is set
|
|
402
407
|
```python
|
|
403
408
|
session.show_paths_template_set_on(template_name)
|
|
404
409
|
```
|
|
405
410
|
|
|
406
|
-
* Show the path prefix where a
|
|
411
|
+
* Show the path prefix where a device template is used (i.e. the time series has been created)
|
|
407
412
|
```python
|
|
408
413
|
session.show_paths_template_using_on(template_name)
|
|
409
414
|
```
|
|
410
415
|
|
|
411
|
-
#### Drop
|
|
416
|
+
#### Drop Device Template
|
|
412
417
|
Delete an existing metadata template,dropping an already set template is not supported
|
|
413
418
|
```python
|
|
414
419
|
session.drop_schema_template("template_python")
|
|
@@ -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):
|
|
@@ -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.
|
|
177
|
+
client = Client(TCompactProtocol.TCompactProtocolAccelerated(transport))
|
|
180
178
|
else:
|
|
181
|
-
client = Client(TBinaryProtocol.
|
|
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(
|
|
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,
|
|
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(
|
|
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,
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
1444
|
-
|
|
1445
|
-
format_str_list.append("?")
|
|
1446
|
-
values_tobe_packed.append(
|
|
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
|
-
|
|
1449
|
-
|
|
1450
|
-
format_str_list.append("
|
|
1451
|
-
values_tobe_packed.append(
|
|
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
|
-
|
|
1454
|
-
|
|
1455
|
-
format_str_list.append("
|
|
1456
|
-
values_tobe_packed.append(
|
|
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
|
-
|
|
1459
|
-
|
|
1460
|
-
format_str_list.append("
|
|
1461
|
-
values_tobe_packed.append(
|
|
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
|
-
|
|
1464
|
-
|
|
1465
|
-
format_str_list.append("
|
|
1466
|
-
values_tobe_packed.append(
|
|
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
|
-
|
|
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("
|
|
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(
|
|
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
|
|
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
|
|
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
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2120
|
+
show the path prefix where a device template is used
|
|
2158
2121
|
:param template_name:
|
|
2159
2122
|
"""
|
|
2160
2123
|
request = TSQueryTemplateReq(
|