apache-iotdb 2.0.8__tar.gz → 2.0.11__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-2.0.8 → apache_iotdb-2.0.11}/PKG-INFO +35 -3
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/README.md +34 -2
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/apache_iotdb.egg-info/PKG-INFO +35 -3
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/apache_iotdb.egg-info/SOURCES.txt +3 -1
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/Session.py +32 -3
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/SessionPool.py +8 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/dbapi/Connection.py +33 -2
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/table_session.py +6 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/table_session_pool.py +4 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/common/constants.py +2 -1
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/common/ttypes.py +216 -83
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/confignode/IConfigNodeRPCService.py +2190 -459
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/confignode/constants.py +2 -1
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/confignode/ttypes.py +1748 -812
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/datanode/IDataNodeRPCService.py +2654 -534
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/datanode/MPPDataExchangeService.py +43 -8
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/datanode/constants.py +2 -1
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/datanode/ttypes.py +2542 -962
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/rpc/IClientRPCService.py +972 -128
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/rpc/constants.py +2 -1
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/rpc/ttypes.py +551 -57
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/rpc_utils.py +53 -3
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/pyproject.toml +1 -1
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_treemodel_insert.py +1 -2
- apache_iotdb-2.0.11/tests/unit/test_session_connection.py +116 -0
- apache_iotdb-2.0.11/tests/unit/test_session_ssl.py +152 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/apache_iotdb.egg-info/dependency_links.txt +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/apache_iotdb.egg-info/entry_points.txt +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/apache_iotdb.egg-info/requires.txt +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/apache_iotdb.egg-info/top_level.txt +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/dbapi/Cursor.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/dbapi/Exceptions.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/dbapi/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/sqlalchemy/IoTDBDialect.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/sqlalchemy/IoTDBIdentifierPreparer.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/sqlalchemy/IoTDBSQLCompiler.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/sqlalchemy/IoTDBTypeCompiler.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/sqlalchemy/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/template/MeasurementNode.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/template/Template.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/template/TemplateNode.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/template/TemplateQueryType.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/template/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/common/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/confignode/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/datanode/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/thrift/rpc/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/common/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/common/constant/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/common/constant/tsfile_constant.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/utils/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/utils/date_utils.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/utils/pair.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/utils/read_write_io_utils.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/tsfile/utils/tsblock_serde.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/BitMap.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/Field.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/IoTDBConstants.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/NumpyTablet.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/RowRecord.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/SessionDataSet.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/Tablet.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/exception.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/iotdb/utils/iotdb_rpc_dataset.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/setup.cfg +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/dbapi/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/dbapi/test_connection.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/dbapi/test_cursor.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/iotdb_container.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/sqlalchemy/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/sqlalchemy/test_dialect.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/tablet_performance_comparison.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_aligned_timeseries.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_dataframe.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_delete_data.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_new_data_types.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_one_device.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_relational_session.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_session.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_session_pool.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_tablemodel_insert.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_tablemodel_query.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_tablet.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/integration/test_todf.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/unit/__init__.py +0 -0
- {apache_iotdb-2.0.8 → apache_iotdb-2.0.11}/tests/unit/test_numpy_tablet.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apache-iotdb
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.11
|
|
4
4
|
Summary: Apache IoTDB client API
|
|
5
5
|
Author-email: Apache IoTDB <dev@iotdb.apache.org>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -112,6 +112,40 @@ Notice: this RPC compression status of client must comply with that of IoTDB ser
|
|
|
112
112
|
session.close()
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
### SSL and Mutual TLS
|
|
116
|
+
|
|
117
|
+
Use `use_ssl=True` and `ca_certs` to enable SSL and verify the server certificate.
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
session = Session(
|
|
121
|
+
ip,
|
|
122
|
+
port_,
|
|
123
|
+
username_,
|
|
124
|
+
password_,
|
|
125
|
+
use_ssl=True,
|
|
126
|
+
ca_certs="/path/ca.crt",
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
When the server enables Thrift mutual TLS, also configure a client certificate and an unencrypted PEM private key.
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
session = Session(
|
|
134
|
+
ip,
|
|
135
|
+
port_,
|
|
136
|
+
username_,
|
|
137
|
+
password_,
|
|
138
|
+
use_ssl=True,
|
|
139
|
+
ca_certs="/path/ca.crt",
|
|
140
|
+
client_cert="/path/client.crt",
|
|
141
|
+
client_key="/path/client.key",
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`client_cert` and `client_key` must be set together. `client_key` should be protected by file permissions because encrypted private keys are not supported by this client API.
|
|
146
|
+
|
|
147
|
+
The same SSL parameters are available in `PoolConfig`, `TableSessionConfig`, `TableSessionPoolConfig`, and DBAPI `connect`.
|
|
148
|
+
|
|
115
149
|
### Data Definition Interface (DDL Interface)
|
|
116
150
|
|
|
117
151
|
#### DATABASE Management
|
|
@@ -628,5 +662,3 @@ Namely, these are
|
|
|
628
662
|
* Release to pypi
|
|
629
663
|
|
|
630
664
|
|
|
631
|
-
|
|
632
|
-
|
|
@@ -90,6 +90,40 @@ Notice: this RPC compression status of client must comply with that of IoTDB ser
|
|
|
90
90
|
session.close()
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
### SSL and Mutual TLS
|
|
94
|
+
|
|
95
|
+
Use `use_ssl=True` and `ca_certs` to enable SSL and verify the server certificate.
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
session = Session(
|
|
99
|
+
ip,
|
|
100
|
+
port_,
|
|
101
|
+
username_,
|
|
102
|
+
password_,
|
|
103
|
+
use_ssl=True,
|
|
104
|
+
ca_certs="/path/ca.crt",
|
|
105
|
+
)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
When the server enables Thrift mutual TLS, also configure a client certificate and an unencrypted PEM private key.
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
session = Session(
|
|
112
|
+
ip,
|
|
113
|
+
port_,
|
|
114
|
+
username_,
|
|
115
|
+
password_,
|
|
116
|
+
use_ssl=True,
|
|
117
|
+
ca_certs="/path/ca.crt",
|
|
118
|
+
client_cert="/path/client.crt",
|
|
119
|
+
client_key="/path/client.key",
|
|
120
|
+
)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`client_cert` and `client_key` must be set together. `client_key` should be protected by file permissions because encrypted private keys are not supported by this client API.
|
|
124
|
+
|
|
125
|
+
The same SSL parameters are available in `PoolConfig`, `TableSessionConfig`, `TableSessionPoolConfig`, and DBAPI `connect`.
|
|
126
|
+
|
|
93
127
|
### Data Definition Interface (DDL Interface)
|
|
94
128
|
|
|
95
129
|
#### DATABASE Management
|
|
@@ -606,5 +640,3 @@ Namely, these are
|
|
|
606
640
|
* Release to pypi
|
|
607
641
|
|
|
608
642
|
|
|
609
|
-
|
|
610
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apache-iotdb
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.11
|
|
4
4
|
Summary: Apache IoTDB client API
|
|
5
5
|
Author-email: Apache IoTDB <dev@iotdb.apache.org>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -112,6 +112,40 @@ Notice: this RPC compression status of client must comply with that of IoTDB ser
|
|
|
112
112
|
session.close()
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
### SSL and Mutual TLS
|
|
116
|
+
|
|
117
|
+
Use `use_ssl=True` and `ca_certs` to enable SSL and verify the server certificate.
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
session = Session(
|
|
121
|
+
ip,
|
|
122
|
+
port_,
|
|
123
|
+
username_,
|
|
124
|
+
password_,
|
|
125
|
+
use_ssl=True,
|
|
126
|
+
ca_certs="/path/ca.crt",
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
When the server enables Thrift mutual TLS, also configure a client certificate and an unencrypted PEM private key.
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
session = Session(
|
|
134
|
+
ip,
|
|
135
|
+
port_,
|
|
136
|
+
username_,
|
|
137
|
+
password_,
|
|
138
|
+
use_ssl=True,
|
|
139
|
+
ca_certs="/path/ca.crt",
|
|
140
|
+
client_cert="/path/client.crt",
|
|
141
|
+
client_key="/path/client.key",
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`client_cert` and `client_key` must be set together. `client_key` should be protected by file permissions because encrypted private keys are not supported by this client API.
|
|
146
|
+
|
|
147
|
+
The same SSL parameters are available in `PoolConfig`, `TableSessionConfig`, `TableSessionPoolConfig`, and DBAPI `connect`.
|
|
148
|
+
|
|
115
149
|
### Data Definition Interface (DDL Interface)
|
|
116
150
|
|
|
117
151
|
#### DATABASE Management
|
|
@@ -628,5 +662,3 @@ Namely, these are
|
|
|
628
662
|
* Release to pypi
|
|
629
663
|
|
|
630
664
|
|
|
631
|
-
|
|
632
|
-
|
|
@@ -85,4 +85,6 @@ tests/integration/dbapi/test_cursor.py
|
|
|
85
85
|
tests/integration/sqlalchemy/__init__.py
|
|
86
86
|
tests/integration/sqlalchemy/test_dialect.py
|
|
87
87
|
tests/unit/__init__.py
|
|
88
|
-
tests/unit/test_numpy_tablet.py
|
|
88
|
+
tests/unit/test_numpy_tablet.py
|
|
89
|
+
tests/unit/test_session_connection.py
|
|
90
|
+
tests/unit/test_session_ssl.py
|
|
@@ -87,6 +87,8 @@ class Session(object):
|
|
|
87
87
|
use_ssl=False,
|
|
88
88
|
ca_certs=None,
|
|
89
89
|
connection_timeout_in_ms=None,
|
|
90
|
+
client_cert=None,
|
|
91
|
+
client_key=None,
|
|
90
92
|
):
|
|
91
93
|
self.__host = host
|
|
92
94
|
self.__port = port
|
|
@@ -117,6 +119,8 @@ class Session(object):
|
|
|
117
119
|
self.database = None
|
|
118
120
|
self.__use_ssl = use_ssl
|
|
119
121
|
self.__ca_certs = ca_certs
|
|
122
|
+
self.__client_cert = client_cert
|
|
123
|
+
self.__client_key = client_key
|
|
120
124
|
self.__connection_timeout_in_ms = connection_timeout_in_ms
|
|
121
125
|
self.__time_precision = "ms"
|
|
122
126
|
|
|
@@ -132,6 +136,8 @@ class Session(object):
|
|
|
132
136
|
use_ssl=False,
|
|
133
137
|
ca_certs=None,
|
|
134
138
|
connection_timeout_in_ms=None,
|
|
139
|
+
client_cert=None,
|
|
140
|
+
client_key=None,
|
|
135
141
|
):
|
|
136
142
|
if node_urls is None:
|
|
137
143
|
raise RuntimeError("node urls is empty")
|
|
@@ -145,6 +151,8 @@ class Session(object):
|
|
|
145
151
|
enable_redirection,
|
|
146
152
|
use_ssl=use_ssl,
|
|
147
153
|
ca_certs=ca_certs,
|
|
154
|
+
client_cert=client_cert,
|
|
155
|
+
client_key=client_key,
|
|
148
156
|
connection_timeout_in_ms=connection_timeout_in_ms,
|
|
149
157
|
)
|
|
150
158
|
session.__hosts = []
|
|
@@ -171,7 +179,7 @@ class Session(object):
|
|
|
171
179
|
self.__default_connection = self.init_connection(
|
|
172
180
|
self.__default_endpoint
|
|
173
181
|
)
|
|
174
|
-
except
|
|
182
|
+
except IoTDBConnectionException as e:
|
|
175
183
|
if not self.reconnect():
|
|
176
184
|
if str(e).startswith("Could not connect to any of"):
|
|
177
185
|
error_msg = (
|
|
@@ -232,9 +240,12 @@ class Session(object):
|
|
|
232
240
|
session_id = open_resp.sessionId
|
|
233
241
|
statement_id = client.requestStatementId(session_id)
|
|
234
242
|
|
|
235
|
-
except
|
|
243
|
+
except TTransport.TTransportException as e:
|
|
236
244
|
transport.close()
|
|
237
245
|
raise IoTDBConnectionException(e) from None
|
|
246
|
+
except Exception:
|
|
247
|
+
transport.close()
|
|
248
|
+
raise
|
|
238
249
|
|
|
239
250
|
if self.__zone_id is not None:
|
|
240
251
|
request = TSSetTimeZoneReq(session_id, self.__zone_id)
|
|
@@ -259,7 +270,21 @@ class Session(object):
|
|
|
259
270
|
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
|
|
260
271
|
context.verify_mode = ssl.CERT_REQUIRED
|
|
261
272
|
context.check_hostname = True
|
|
262
|
-
|
|
273
|
+
context.load_default_certs(ssl.Purpose.SERVER_AUTH)
|
|
274
|
+
if self.__has_text(self.__ca_certs):
|
|
275
|
+
context.load_verify_locations(cafile=self.__ca_certs)
|
|
276
|
+
if self.__has_text(self.__client_cert) or self.__has_text(
|
|
277
|
+
self.__client_key
|
|
278
|
+
):
|
|
279
|
+
if not self.__has_text(self.__client_cert) or not self.__has_text(
|
|
280
|
+
self.__client_key
|
|
281
|
+
):
|
|
282
|
+
raise TTransport.TTransportException(
|
|
283
|
+
message="client_cert and client_key must be set together."
|
|
284
|
+
)
|
|
285
|
+
context.load_cert_chain(
|
|
286
|
+
certfile=self.__client_cert, keyfile=self.__client_key
|
|
287
|
+
)
|
|
263
288
|
socket = TSSLSocket.TSSLSocket(
|
|
264
289
|
host=endpoint.ip, port=endpoint.port, ssl_context=context
|
|
265
290
|
)
|
|
@@ -275,6 +300,10 @@ class Session(object):
|
|
|
275
300
|
raise IoTDBConnectionException(e) from None
|
|
276
301
|
return transport
|
|
277
302
|
|
|
303
|
+
@staticmethod
|
|
304
|
+
def __has_text(value):
|
|
305
|
+
return value is not None and str(value).strip() != ""
|
|
306
|
+
|
|
278
307
|
def is_open(self):
|
|
279
308
|
return not self.__is_close
|
|
280
309
|
|
|
@@ -49,6 +49,8 @@ class PoolConfig(object):
|
|
|
49
49
|
use_ssl: bool = False,
|
|
50
50
|
ca_certs: str = None,
|
|
51
51
|
connection_timeout_in_ms: int = None,
|
|
52
|
+
client_cert: str = None,
|
|
53
|
+
client_key: str = None,
|
|
52
54
|
):
|
|
53
55
|
self.host = host
|
|
54
56
|
self.port = port
|
|
@@ -68,6 +70,8 @@ class PoolConfig(object):
|
|
|
68
70
|
self.enable_redirection = enable_redirection
|
|
69
71
|
self.use_ssl = use_ssl
|
|
70
72
|
self.ca_certs = ca_certs
|
|
73
|
+
self.client_cert = client_cert
|
|
74
|
+
self.client_key = client_key
|
|
71
75
|
self.connection_timeout_in_ms = connection_timeout_in_ms
|
|
72
76
|
|
|
73
77
|
|
|
@@ -96,6 +100,8 @@ class SessionPool(object):
|
|
|
96
100
|
enable_redirection=self.__pool_config.enable_redirection,
|
|
97
101
|
use_ssl=self.__pool_config.use_ssl,
|
|
98
102
|
ca_certs=self.__pool_config.ca_certs,
|
|
103
|
+
client_cert=self.__pool_config.client_cert,
|
|
104
|
+
client_key=self.__pool_config.client_key,
|
|
99
105
|
connection_timeout_in_ms=self.__pool_config.connection_timeout_in_ms,
|
|
100
106
|
)
|
|
101
107
|
session.sql_dialect = self.sql_dialect
|
|
@@ -112,6 +118,8 @@ class SessionPool(object):
|
|
|
112
118
|
enable_redirection=self.__pool_config.enable_redirection,
|
|
113
119
|
use_ssl=self.__pool_config.use_ssl,
|
|
114
120
|
ca_certs=self.__pool_config.ca_certs,
|
|
121
|
+
client_cert=self.__pool_config.client_cert,
|
|
122
|
+
client_key=self.__pool_config.client_key,
|
|
115
123
|
connection_timeout_in_ms=self.__pool_config.connection_timeout_in_ms,
|
|
116
124
|
)
|
|
117
125
|
session.sql_dialect = self.sql_dialect
|
|
@@ -37,12 +37,29 @@ class Connection(object):
|
|
|
37
37
|
zone_id=Session.DEFAULT_ZONE_ID,
|
|
38
38
|
enable_rpc_compression=False,
|
|
39
39
|
sqlalchemy_mode=False,
|
|
40
|
+
use_ssl=False,
|
|
41
|
+
ca_certs=None,
|
|
42
|
+
connection_timeout_in_ms=None,
|
|
43
|
+
client_cert=None,
|
|
44
|
+
client_key=None,
|
|
40
45
|
):
|
|
41
|
-
self.__session = Session(
|
|
46
|
+
self.__session = Session(
|
|
47
|
+
host,
|
|
48
|
+
port,
|
|
49
|
+
username,
|
|
50
|
+
password,
|
|
51
|
+
fetch_size,
|
|
52
|
+
zone_id,
|
|
53
|
+
use_ssl=self.__to_bool(use_ssl),
|
|
54
|
+
ca_certs=ca_certs,
|
|
55
|
+
connection_timeout_in_ms=self.__to_optional_int(connection_timeout_in_ms),
|
|
56
|
+
client_cert=client_cert,
|
|
57
|
+
client_key=client_key,
|
|
58
|
+
)
|
|
42
59
|
self.__sqlalchemy_mode = sqlalchemy_mode
|
|
43
60
|
self.__is_close = True
|
|
44
61
|
try:
|
|
45
|
-
self.__session.open(enable_rpc_compression)
|
|
62
|
+
self.__session.open(self.__to_bool(enable_rpc_compression))
|
|
46
63
|
self.__is_close = False
|
|
47
64
|
except Exception as e:
|
|
48
65
|
raise ConnectionError(e)
|
|
@@ -89,3 +106,17 @@ class Connection(object):
|
|
|
89
106
|
|
|
90
107
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
91
108
|
self.close()
|
|
109
|
+
|
|
110
|
+
@staticmethod
|
|
111
|
+
def __to_bool(value):
|
|
112
|
+
if isinstance(value, bool):
|
|
113
|
+
return value
|
|
114
|
+
if isinstance(value, str):
|
|
115
|
+
return value.strip().lower() in ("true", "1", "yes", "y")
|
|
116
|
+
return bool(value)
|
|
117
|
+
|
|
118
|
+
@staticmethod
|
|
119
|
+
def __to_optional_int(value):
|
|
120
|
+
if value is None or value == "":
|
|
121
|
+
return None
|
|
122
|
+
return int(value)
|
|
@@ -38,6 +38,8 @@ class TableSessionConfig(object):
|
|
|
38
38
|
use_ssl: bool = False,
|
|
39
39
|
ca_certs: str = None,
|
|
40
40
|
connection_timeout_in_ms: int = None,
|
|
41
|
+
client_cert: str = None,
|
|
42
|
+
client_key: str = None,
|
|
41
43
|
):
|
|
42
44
|
"""
|
|
43
45
|
Initialize a TableSessionConfig object with the provided parameters.
|
|
@@ -71,6 +73,8 @@ class TableSessionConfig(object):
|
|
|
71
73
|
self.enable_compression = enable_compression
|
|
72
74
|
self.use_ssl = use_ssl
|
|
73
75
|
self.ca_certs = ca_certs
|
|
76
|
+
self.client_cert = client_cert
|
|
77
|
+
self.client_key = client_key
|
|
74
78
|
self.connection_timeout_in_ms = connection_timeout_in_ms
|
|
75
79
|
|
|
76
80
|
|
|
@@ -91,6 +95,8 @@ class TableSession(object):
|
|
|
91
95
|
table_session_config.use_ssl,
|
|
92
96
|
table_session_config.ca_certs,
|
|
93
97
|
table_session_config.connection_timeout_in_ms,
|
|
98
|
+
client_cert=table_session_config.client_cert,
|
|
99
|
+
client_key=table_session_config.client_key,
|
|
94
100
|
)
|
|
95
101
|
self.__session.sql_dialect = "table"
|
|
96
102
|
self.__session.database = table_session_config.database
|
|
@@ -37,6 +37,8 @@ class TableSessionPoolConfig(object):
|
|
|
37
37
|
use_ssl: bool = False,
|
|
38
38
|
ca_certs: str = None,
|
|
39
39
|
connection_timeout_in_ms: int = None,
|
|
40
|
+
client_cert: str = None,
|
|
41
|
+
client_key: str = None,
|
|
40
42
|
):
|
|
41
43
|
"""
|
|
42
44
|
Initialize a TableSessionPoolConfig object with the provided parameters.
|
|
@@ -77,6 +79,8 @@ class TableSessionPoolConfig(object):
|
|
|
77
79
|
use_ssl=use_ssl,
|
|
78
80
|
ca_certs=ca_certs,
|
|
79
81
|
connection_timeout_in_ms=connection_timeout_in_ms,
|
|
82
|
+
client_cert=client_cert,
|
|
83
|
+
client_key=client_key,
|
|
80
84
|
)
|
|
81
85
|
self.max_pool_size = max_pool_size
|
|
82
86
|
self.wait_timeout_in_ms = wait_timeout_in_ms
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Autogenerated by Thrift Compiler (0.
|
|
2
|
+
# Autogenerated by Thrift Compiler (0.23.0)
|
|
3
3
|
#
|
|
4
4
|
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
5
5
|
#
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
|
|
10
10
|
from thrift.protocol.TProtocol import TProtocolException
|
|
11
11
|
from thrift.TRecursive import fix_spec
|
|
12
|
+
from uuid import UUID
|
|
12
13
|
|
|
13
14
|
import sys
|
|
14
15
|
from .ttypes import *
|