apache-iotdb 1.3.4__tar.gz → 2.0.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.3.4 → apache-iotdb-2.0.2}/PKG-INFO +4 -4
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/README.md +2 -2
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/apache_iotdb.egg-info/PKG-INFO +4 -4
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/apache_iotdb.egg-info/SOURCES.txt +11 -6
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/apache_iotdb.egg-info/requires.txt +1 -1
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/Session.py +214 -21
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/SessionPool.py +14 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/sqlalchemy/IoTDBDialect.py +11 -4
- apache-iotdb-2.0.2/iotdb/table_session.py +156 -0
- apache-iotdb-2.0.2/iotdb/table_session_pool.py +122 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/thrift/common/ttypes.py +57 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/thrift/rpc/IClientRPCService.py +12 -12
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/thrift/rpc/ttypes.py +615 -507
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/Field.py +0 -1
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/IoTDBRpcDataSet.py +1 -1
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/NumpyTablet.py +39 -14
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/Tablet.py +50 -14
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/pyproject.toml +2 -2
- {apache-iotdb-1.3.4/iotdb/dbapi/tests → apache-iotdb-2.0.2/tests/integration/dbapi}/test_connection.py +1 -1
- {apache-iotdb-1.3.4/iotdb/dbapi/tests → apache-iotdb-2.0.2/tests/integration/dbapi}/test_cursor.py +1 -1
- {apache-iotdb-1.3.4/iotdb/sqlalchemy/tests → apache-iotdb-2.0.2/tests/integration/sqlalchemy}/test_dialect.py +28 -15
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_aligned_timeseries.py +1 -1
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_dataframe.py +1 -1
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_delete_data.py +1 -1
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_new_data_types.py +1 -1
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_one_device.py +1 -1
- apache-iotdb-2.0.2/tests/integration/test_relational_session.py +128 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_session.py +82 -20
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_session_pool.py +1 -1
- apache-iotdb-2.0.2/tests/integration/test_tablemodel_insert.py +1592 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_tablet.py +1 -1
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/test_todf.py +1 -1
- apache-iotdb-2.0.2/tests/integration/test_treemodel_insert.py +6027 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/apache_iotdb.egg-info/dependency_links.txt +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/apache_iotdb.egg-info/entry_points.txt +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/apache_iotdb.egg-info/top_level.txt +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/dbapi/Connection.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/dbapi/Cursor.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/dbapi/Exceptions.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/dbapi/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/sqlalchemy/IoTDBIdentifierPreparer.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/sqlalchemy/IoTDBSQLCompiler.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/sqlalchemy/IoTDBTypeCompiler.py +0 -0
- {apache-iotdb-1.3.4/iotdb/dbapi/tests → apache-iotdb-2.0.2/iotdb/sqlalchemy}/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/template/MeasurementNode.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/template/Template.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/template/TemplateNode.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/template/TemplateQueryType.py +0 -0
- {apache-iotdb-1.3.4/iotdb/sqlalchemy → apache-iotdb-2.0.2/iotdb/template}/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/thrift/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/thrift/common/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/thrift/common/constants.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/thrift/rpc/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/thrift/rpc/constants.py +0 -0
- {apache-iotdb-1.3.4/iotdb/sqlalchemy/tests → apache-iotdb-2.0.2/iotdb/tsfile}/__init__.py +0 -0
- {apache-iotdb-1.3.4/iotdb/template → apache-iotdb-2.0.2/iotdb/tsfile/common}/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/tsfile/common/constant/TsFileConstant.py +0 -0
- {apache-iotdb-1.3.4/iotdb/tsfile → apache-iotdb-2.0.2/iotdb/tsfile/common/constant}/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/tsfile/utils/DateUtils.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/tsfile/utils/Pair.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/tsfile/utils/ReadWriteIOUtils.py +0 -0
- {apache-iotdb-1.3.4/iotdb/tsfile/common → apache-iotdb-2.0.2/iotdb/tsfile/utils}/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/BitMap.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/IoTDBConnectionException.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/IoTDBConstants.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/RowRecord.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/iotdb/utils/SessionDataSet.py +0 -0
- {apache-iotdb-1.3.4/iotdb/tsfile/common/constant → apache-iotdb-2.0.2/iotdb/utils}/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/setup.cfg +0 -0
- {apache-iotdb-1.3.4/iotdb/tsfile/utils → apache-iotdb-2.0.2/tests}/__init__.py +0 -0
- {apache-iotdb-1.3.4/iotdb/utils → apache-iotdb-2.0.2/tests/integration}/__init__.py +0 -0
- {apache-iotdb-1.3.4/tests → apache-iotdb-2.0.2/tests/integration/dbapi}/__init__.py +0 -0
- /apache-iotdb-1.3.4/iotdb/IoTDBContainer.py → /apache-iotdb-2.0.2/tests/integration/iotdb_container.py +0 -0
- {apache-iotdb-1.3.4/tests/integration → apache-iotdb-2.0.2/tests/integration/sqlalchemy}/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/integration/tablet_performance_comparison.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/unit/__init__.py +0 -0
- {apache-iotdb-1.3.4 → apache-iotdb-2.0.2}/tests/unit/test_numpy_tablet.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-iotdb
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Apache IoTDB client API
|
|
5
5
|
Author-email: Apache IoTDB <dev@iotdb.apache.org>
|
|
6
6
|
License: Apache License, Version 2.0
|
|
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
Requires-Dist: thrift>=0.14.1
|
|
18
18
|
Requires-Dist: pandas>=1.0.0
|
|
19
19
|
Requires-Dist: numpy>=1.0.0
|
|
20
|
-
Requires-Dist: sqlalchemy
|
|
20
|
+
Requires-Dist: sqlalchemy>=1.4
|
|
21
21
|
Requires-Dist: sqlalchemy-utils>=0.37.8
|
|
22
22
|
|
|
23
23
|
<!--
|
|
@@ -69,9 +69,9 @@ You have to install thrift (>=0.14.1) before using the package.
|
|
|
69
69
|
|
|
70
70
|
First, download the latest package: `pip3 install apache-iotdb`
|
|
71
71
|
|
|
72
|
-
You can get an example of using the package to read and write data at here: [Example](https://github.com/apache/iotdb/blob/master/client-py/SessionExample.py)
|
|
72
|
+
You can get an example of using the package to read and write data at here: [Example](https://github.com/apache/iotdb/blob/master/iotdb-client/client-py/SessionExample.py)
|
|
73
73
|
|
|
74
|
-
An example of aligned timeseries: [Aligned Timeseries Session Example](https://github.com/apache/iotdb/blob/master/client-py/SessionAlignedTimeseriesExample.py)
|
|
74
|
+
An example of aligned timeseries: [Aligned Timeseries Session Example](https://github.com/apache/iotdb/blob/master/iotdb-client/client-py/SessionAlignedTimeseriesExample.py)
|
|
75
75
|
|
|
76
76
|
(you need to add `import iotdb` in the head of the file)
|
|
77
77
|
|
|
@@ -47,9 +47,9 @@ You have to install thrift (>=0.14.1) before using the package.
|
|
|
47
47
|
|
|
48
48
|
First, download the latest package: `pip3 install apache-iotdb`
|
|
49
49
|
|
|
50
|
-
You can get an example of using the package to read and write data at here: [Example](https://github.com/apache/iotdb/blob/master/client-py/SessionExample.py)
|
|
50
|
+
You can get an example of using the package to read and write data at here: [Example](https://github.com/apache/iotdb/blob/master/iotdb-client/client-py/SessionExample.py)
|
|
51
51
|
|
|
52
|
-
An example of aligned timeseries: [Aligned Timeseries Session Example](https://github.com/apache/iotdb/blob/master/client-py/SessionAlignedTimeseriesExample.py)
|
|
52
|
+
An example of aligned timeseries: [Aligned Timeseries Session Example](https://github.com/apache/iotdb/blob/master/iotdb-client/client-py/SessionAlignedTimeseriesExample.py)
|
|
53
53
|
|
|
54
54
|
(you need to add `import iotdb` in the head of the file)
|
|
55
55
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-iotdb
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Apache IoTDB client API
|
|
5
5
|
Author-email: Apache IoTDB <dev@iotdb.apache.org>
|
|
6
6
|
License: Apache License, Version 2.0
|
|
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
Requires-Dist: thrift>=0.14.1
|
|
18
18
|
Requires-Dist: pandas>=1.0.0
|
|
19
19
|
Requires-Dist: numpy>=1.0.0
|
|
20
|
-
Requires-Dist: sqlalchemy
|
|
20
|
+
Requires-Dist: sqlalchemy>=1.4
|
|
21
21
|
Requires-Dist: sqlalchemy-utils>=0.37.8
|
|
22
22
|
|
|
23
23
|
<!--
|
|
@@ -69,9 +69,9 @@ You have to install thrift (>=0.14.1) before using the package.
|
|
|
69
69
|
|
|
70
70
|
First, download the latest package: `pip3 install apache-iotdb`
|
|
71
71
|
|
|
72
|
-
You can get an example of using the package to read and write data at here: [Example](https://github.com/apache/iotdb/blob/master/client-py/SessionExample.py)
|
|
72
|
+
You can get an example of using the package to read and write data at here: [Example](https://github.com/apache/iotdb/blob/master/iotdb-client/client-py/SessionExample.py)
|
|
73
73
|
|
|
74
|
-
An example of aligned timeseries: [Aligned Timeseries Session Example](https://github.com/apache/iotdb/blob/master/client-py/SessionAlignedTimeseriesExample.py)
|
|
74
|
+
An example of aligned timeseries: [Aligned Timeseries Session Example](https://github.com/apache/iotdb/blob/master/iotdb-client/client-py/SessionAlignedTimeseriesExample.py)
|
|
75
75
|
|
|
76
76
|
(you need to add `import iotdb` in the head of the file)
|
|
77
77
|
|
|
@@ -6,24 +6,20 @@ apache_iotdb.egg-info/dependency_links.txt
|
|
|
6
6
|
apache_iotdb.egg-info/entry_points.txt
|
|
7
7
|
apache_iotdb.egg-info/requires.txt
|
|
8
8
|
apache_iotdb.egg-info/top_level.txt
|
|
9
|
-
iotdb/IoTDBContainer.py
|
|
10
9
|
iotdb/Session.py
|
|
11
10
|
iotdb/SessionPool.py
|
|
12
11
|
iotdb/__init__.py
|
|
12
|
+
iotdb/table_session.py
|
|
13
|
+
iotdb/table_session_pool.py
|
|
13
14
|
iotdb/dbapi/Connection.py
|
|
14
15
|
iotdb/dbapi/Cursor.py
|
|
15
16
|
iotdb/dbapi/Exceptions.py
|
|
16
17
|
iotdb/dbapi/__init__.py
|
|
17
|
-
iotdb/dbapi/tests/__init__.py
|
|
18
|
-
iotdb/dbapi/tests/test_connection.py
|
|
19
|
-
iotdb/dbapi/tests/test_cursor.py
|
|
20
18
|
iotdb/sqlalchemy/IoTDBDialect.py
|
|
21
19
|
iotdb/sqlalchemy/IoTDBIdentifierPreparer.py
|
|
22
20
|
iotdb/sqlalchemy/IoTDBSQLCompiler.py
|
|
23
21
|
iotdb/sqlalchemy/IoTDBTypeCompiler.py
|
|
24
22
|
iotdb/sqlalchemy/__init__.py
|
|
25
|
-
iotdb/sqlalchemy/tests/__init__.py
|
|
26
|
-
iotdb/sqlalchemy/tests/test_dialect.py
|
|
27
23
|
iotdb/template/MeasurementNode.py
|
|
28
24
|
iotdb/template/Template.py
|
|
29
25
|
iotdb/template/TemplateNode.py
|
|
@@ -57,15 +53,24 @@ iotdb/utils/Tablet.py
|
|
|
57
53
|
iotdb/utils/__init__.py
|
|
58
54
|
tests/__init__.py
|
|
59
55
|
tests/integration/__init__.py
|
|
56
|
+
tests/integration/iotdb_container.py
|
|
60
57
|
tests/integration/tablet_performance_comparison.py
|
|
61
58
|
tests/integration/test_aligned_timeseries.py
|
|
62
59
|
tests/integration/test_dataframe.py
|
|
63
60
|
tests/integration/test_delete_data.py
|
|
64
61
|
tests/integration/test_new_data_types.py
|
|
65
62
|
tests/integration/test_one_device.py
|
|
63
|
+
tests/integration/test_relational_session.py
|
|
66
64
|
tests/integration/test_session.py
|
|
67
65
|
tests/integration/test_session_pool.py
|
|
66
|
+
tests/integration/test_tablemodel_insert.py
|
|
68
67
|
tests/integration/test_tablet.py
|
|
69
68
|
tests/integration/test_todf.py
|
|
69
|
+
tests/integration/test_treemodel_insert.py
|
|
70
|
+
tests/integration/dbapi/__init__.py
|
|
71
|
+
tests/integration/dbapi/test_connection.py
|
|
72
|
+
tests/integration/dbapi/test_cursor.py
|
|
73
|
+
tests/integration/sqlalchemy/__init__.py
|
|
74
|
+
tests/integration/sqlalchemy/test_dialect.py
|
|
70
75
|
tests/unit/__init__.py
|
|
71
76
|
tests/unit/test_numpy_tablet.py
|
|
@@ -70,11 +70,12 @@ class Session(object):
|
|
|
70
70
|
SUCCESS_STATUS = 200
|
|
71
71
|
MULTIPLE_ERROR = 302
|
|
72
72
|
REDIRECTION_RECOMMEND = 400
|
|
73
|
-
DEFAULT_FETCH_SIZE =
|
|
73
|
+
DEFAULT_FETCH_SIZE = 5000
|
|
74
74
|
DEFAULT_USER = "root"
|
|
75
75
|
DEFAULT_PASSWORD = "root"
|
|
76
76
|
DEFAULT_ZONE_ID = time.strftime("%z")
|
|
77
77
|
RETRY_NUM = 3
|
|
78
|
+
SQL_DIALECT = "tree"
|
|
78
79
|
|
|
79
80
|
def __init__(
|
|
80
81
|
self,
|
|
@@ -108,6 +109,8 @@ class Session(object):
|
|
|
108
109
|
self.__enable_redirection = enable_redirection
|
|
109
110
|
self.__device_id_to_endpoint = None
|
|
110
111
|
self.__endpoint_to_connection = None
|
|
112
|
+
self.sql_dialect = self.SQL_DIALECT
|
|
113
|
+
self.database = None
|
|
111
114
|
self.__use_ssl = use_ssl
|
|
112
115
|
self.__ca_certs = ca_certs
|
|
113
116
|
self.__connection_timeout_in_ms = connection_timeout_in_ms
|
|
@@ -191,12 +194,15 @@ class Session(object):
|
|
|
191
194
|
else:
|
|
192
195
|
client = Client(TBinaryProtocol.TBinaryProtocolAccelerated(transport))
|
|
193
196
|
|
|
197
|
+
configuration = {"version": "V_1_0", "sql_dialect": self.sql_dialect}
|
|
198
|
+
if self.database is not None:
|
|
199
|
+
configuration["db"] = self.database
|
|
194
200
|
open_req = TSOpenSessionReq(
|
|
195
201
|
client_protocol=self.protocol_version,
|
|
196
202
|
username=self.__user,
|
|
197
203
|
password=self.__password,
|
|
198
204
|
zoneId=self.__zone_id,
|
|
199
|
-
configuration=
|
|
205
|
+
configuration=configuration,
|
|
200
206
|
)
|
|
201
207
|
|
|
202
208
|
try:
|
|
@@ -535,6 +541,15 @@ class Session(object):
|
|
|
535
541
|
string_values = [string_values]
|
|
536
542
|
if type(measurements) == str:
|
|
537
543
|
measurements = [measurements]
|
|
544
|
+
if self.__has_none_value(string_values):
|
|
545
|
+
filtered_measurements, filtered_values = zip(
|
|
546
|
+
*[(m, v) for m, v in zip(measurements, string_values) if v is not None]
|
|
547
|
+
)
|
|
548
|
+
measurements = list(filtered_measurements)
|
|
549
|
+
values = list(filtered_values)
|
|
550
|
+
if len(measurements) == 0 or len(values) == 0:
|
|
551
|
+
logger.info("All inserting values are none!")
|
|
552
|
+
return
|
|
538
553
|
request = self.gen_insert_str_record_req(
|
|
539
554
|
device_id, timestamp, measurements, string_values
|
|
540
555
|
)
|
|
@@ -566,6 +581,15 @@ class Session(object):
|
|
|
566
581
|
string_values = [string_values]
|
|
567
582
|
if type(measurements) == str:
|
|
568
583
|
measurements = [measurements]
|
|
584
|
+
if self.__has_none_value(string_values):
|
|
585
|
+
filtered_measurements, filtered_values = zip(
|
|
586
|
+
*[(m, v) for m, v in zip(measurements, string_values) if v is not None]
|
|
587
|
+
)
|
|
588
|
+
measurements = list(filtered_measurements)
|
|
589
|
+
values = list(filtered_values)
|
|
590
|
+
if len(measurements) == 0 or len(values) == 0:
|
|
591
|
+
logger.info("All inserting values are none!")
|
|
592
|
+
return
|
|
569
593
|
request = self.gen_insert_str_record_req(
|
|
570
594
|
device_id, timestamp, measurements, string_values, True
|
|
571
595
|
)
|
|
@@ -601,6 +625,20 @@ class Session(object):
|
|
|
601
625
|
:param data_types: List of TSDataType, indicate the data type for each sensor
|
|
602
626
|
:param values: List, values to be inserted, for each sensor
|
|
603
627
|
"""
|
|
628
|
+
if self.__has_none_value(values):
|
|
629
|
+
filtered_measurements, filtered_data_types, filtered_values = zip(
|
|
630
|
+
*[
|
|
631
|
+
(m, d, v)
|
|
632
|
+
for m, d, v in zip(measurements, data_types, values)
|
|
633
|
+
if v is not None
|
|
634
|
+
]
|
|
635
|
+
)
|
|
636
|
+
measurements = list(filtered_measurements)
|
|
637
|
+
data_types = list(filtered_data_types)
|
|
638
|
+
values = list(filtered_values)
|
|
639
|
+
if len(measurements) == 0 or len(data_types) == 0 or len(values) == 0:
|
|
640
|
+
logger.info("All inserting values are none!")
|
|
641
|
+
return
|
|
604
642
|
request = self.gen_insert_record_req(
|
|
605
643
|
device_id, timestamp, measurements, data_types, values
|
|
606
644
|
)
|
|
@@ -634,6 +672,19 @@ class Session(object):
|
|
|
634
672
|
:param types_lst: 2-D List of TSDataType, each element of outer list indicates sensor data types of a device
|
|
635
673
|
:param values_lst: 2-D List, values to be inserted, for each device
|
|
636
674
|
"""
|
|
675
|
+
if self.__has_none_value(values_lst):
|
|
676
|
+
(
|
|
677
|
+
device_ids,
|
|
678
|
+
times,
|
|
679
|
+
measurements_lst,
|
|
680
|
+
types_lst,
|
|
681
|
+
values_lst,
|
|
682
|
+
) = self.__filter_lists_by_values(
|
|
683
|
+
device_ids, times, measurements_lst, types_lst, values_lst
|
|
684
|
+
)
|
|
685
|
+
if len(device_ids) == 0:
|
|
686
|
+
logger.info("All inserting values are none!")
|
|
687
|
+
return
|
|
637
688
|
if self.__enable_redirection:
|
|
638
689
|
request_group = {}
|
|
639
690
|
for i in range(len(device_ids)):
|
|
@@ -703,6 +754,20 @@ class Session(object):
|
|
|
703
754
|
:param data_types: List of TSDataType, indicate the data type for each sensor
|
|
704
755
|
:param values: List, values to be inserted, for each sensor
|
|
705
756
|
"""
|
|
757
|
+
if self.__has_none_value(values):
|
|
758
|
+
filtered_measurements, filtered_data_types, filtered_values = zip(
|
|
759
|
+
*[
|
|
760
|
+
(m, d, v)
|
|
761
|
+
for m, d, v in zip(measurements, data_types, values)
|
|
762
|
+
if v is not None
|
|
763
|
+
]
|
|
764
|
+
)
|
|
765
|
+
measurements = list(filtered_measurements)
|
|
766
|
+
data_types = list(filtered_data_types)
|
|
767
|
+
values = list(filtered_values)
|
|
768
|
+
if len(measurements) == 0 or len(data_types) == 0 or len(values) == 0:
|
|
769
|
+
logger.info("All inserting values are none!")
|
|
770
|
+
return
|
|
706
771
|
request = self.gen_insert_record_req(
|
|
707
772
|
device_id, timestamp, measurements, data_types, values, True
|
|
708
773
|
)
|
|
@@ -736,6 +801,19 @@ class Session(object):
|
|
|
736
801
|
:param types_lst: 2-D List of TSDataType, each element of outer list indicates sensor data types of a device
|
|
737
802
|
:param values_lst: 2-D List, values to be inserted, for each device
|
|
738
803
|
"""
|
|
804
|
+
if self.__has_none_value(values_lst):
|
|
805
|
+
(
|
|
806
|
+
device_ids,
|
|
807
|
+
times,
|
|
808
|
+
measurements_lst,
|
|
809
|
+
types_lst,
|
|
810
|
+
values_lst,
|
|
811
|
+
) = self.__filter_lists_by_values(
|
|
812
|
+
device_ids, times, measurements_lst, types_lst, values_lst
|
|
813
|
+
)
|
|
814
|
+
if len(device_ids) == 0:
|
|
815
|
+
logger.info("All inserting values are none!")
|
|
816
|
+
return
|
|
739
817
|
if self.__enable_redirection:
|
|
740
818
|
request_group = {}
|
|
741
819
|
for i in range(len(device_ids)):
|
|
@@ -928,13 +1006,15 @@ class Session(object):
|
|
|
928
1006
|
"""
|
|
929
1007
|
request = self.gen_insert_tablet_req(tablet)
|
|
930
1008
|
try:
|
|
931
|
-
connection = self.get_connection(tablet.
|
|
1009
|
+
connection = self.get_connection(tablet.get_insert_target_name())
|
|
932
1010
|
request.sessionId = connection.session_id
|
|
933
1011
|
return Session.verify_success_with_redirection(
|
|
934
1012
|
connection.client.insertTablet(request)
|
|
935
1013
|
)
|
|
936
1014
|
except RedirectException as e:
|
|
937
|
-
return self.handle_redirection(
|
|
1015
|
+
return self.handle_redirection(
|
|
1016
|
+
tablet.get_insert_target_name(), e.redirect_node
|
|
1017
|
+
)
|
|
938
1018
|
except TTransport.TException as e:
|
|
939
1019
|
if self.reconnect():
|
|
940
1020
|
try:
|
|
@@ -953,14 +1033,14 @@ class Session(object):
|
|
|
953
1033
|
if self.__enable_redirection:
|
|
954
1034
|
request_group = {}
|
|
955
1035
|
for i in range(len(tablet_lst)):
|
|
956
|
-
connection = self.get_connection(tablet_lst[i].
|
|
1036
|
+
connection = self.get_connection(tablet_lst[i].get_insert_target_name())
|
|
957
1037
|
request = request_group.setdefault(
|
|
958
1038
|
connection.client,
|
|
959
1039
|
TSInsertTabletsReq(
|
|
960
1040
|
connection.session_id, [], [], [], [], [], [], False
|
|
961
1041
|
),
|
|
962
1042
|
)
|
|
963
|
-
request.prefixPaths.append(tablet_lst[i].
|
|
1043
|
+
request.prefixPaths.append(tablet_lst[i].get_insert_target_name())
|
|
964
1044
|
request.timestampsList.append(tablet_lst[i].get_binary_timestamps())
|
|
965
1045
|
request.measurementsList.append(tablet_lst[i].get_measurements())
|
|
966
1046
|
request.valuesList.append(tablet_lst[i].get_binary_values())
|
|
@@ -1019,13 +1099,15 @@ class Session(object):
|
|
|
1019
1099
|
"""
|
|
1020
1100
|
request = self.gen_insert_tablet_req(tablet, True)
|
|
1021
1101
|
try:
|
|
1022
|
-
connection = self.get_connection(tablet.
|
|
1102
|
+
connection = self.get_connection(tablet.get_insert_target_name())
|
|
1023
1103
|
request.sessionId = connection.session_id
|
|
1024
1104
|
return Session.verify_success_with_redirection(
|
|
1025
1105
|
connection.client.insertTablet(request)
|
|
1026
1106
|
)
|
|
1027
1107
|
except RedirectException as e:
|
|
1028
|
-
return self.handle_redirection(
|
|
1108
|
+
return self.handle_redirection(
|
|
1109
|
+
tablet.get_insert_target_name(), e.redirect_node
|
|
1110
|
+
)
|
|
1029
1111
|
except TTransport.TException as e:
|
|
1030
1112
|
if self.reconnect():
|
|
1031
1113
|
try:
|
|
@@ -1044,14 +1126,14 @@ class Session(object):
|
|
|
1044
1126
|
if self.__enable_redirection:
|
|
1045
1127
|
request_group = {}
|
|
1046
1128
|
for i in range(len(tablet_lst)):
|
|
1047
|
-
connection = self.get_connection(tablet_lst[i].
|
|
1129
|
+
connection = self.get_connection(tablet_lst[i].get_insert_target_name())
|
|
1048
1130
|
request = request_group.setdefault(
|
|
1049
1131
|
connection.client,
|
|
1050
1132
|
TSInsertTabletsReq(
|
|
1051
1133
|
connection.session_id, [], [], [], [], [], [], True
|
|
1052
1134
|
),
|
|
1053
1135
|
)
|
|
1054
|
-
request.prefixPaths.append(tablet_lst[i].
|
|
1136
|
+
request.prefixPaths.append(tablet_lst[i].get_insert_target_name())
|
|
1055
1137
|
request.timestampsList.append(tablet_lst[i].get_binary_timestamps())
|
|
1056
1138
|
request.measurementsList.append(tablet_lst[i].get_measurements())
|
|
1057
1139
|
request.valuesList.append(tablet_lst[i].get_binary_values())
|
|
@@ -1096,6 +1178,36 @@ class Session(object):
|
|
|
1096
1178
|
self.connection_error_msg()
|
|
1097
1179
|
) from None
|
|
1098
1180
|
|
|
1181
|
+
def insert_relational_tablet(self, tablet):
|
|
1182
|
+
"""
|
|
1183
|
+
insert one tablet, for example three column in the table1 can form a tablet:
|
|
1184
|
+
timestamps, id1, attr1, m1
|
|
1185
|
+
1, id:1, attr:1, 1.0
|
|
1186
|
+
2, id:1, attr:1, 2.0
|
|
1187
|
+
3, id:2, attr:2, 3.0
|
|
1188
|
+
:param tablet: a tablet specified above
|
|
1189
|
+
"""
|
|
1190
|
+
request = self.gen_insert_relational_tablet_req(tablet)
|
|
1191
|
+
try:
|
|
1192
|
+
connection = self.get_connection(tablet.get_insert_target_name())
|
|
1193
|
+
request.sessionId = connection.session_id
|
|
1194
|
+
return Session.verify_success_with_redirection(
|
|
1195
|
+
connection.client.insertTablet(request)
|
|
1196
|
+
)
|
|
1197
|
+
except RedirectException as e:
|
|
1198
|
+
return self.handle_redirection(
|
|
1199
|
+
tablet.get_insert_target_name(), e.redirect_node
|
|
1200
|
+
)
|
|
1201
|
+
except TTransport.TException as e:
|
|
1202
|
+
if self.reconnect():
|
|
1203
|
+
try:
|
|
1204
|
+
request.sessionId = self.__session_id
|
|
1205
|
+
return Session.verify_success(self.__client.insertTablet(request))
|
|
1206
|
+
except TTransport.TException as e1:
|
|
1207
|
+
raise IoTDBConnectionException(e1) from None
|
|
1208
|
+
else:
|
|
1209
|
+
raise IoTDBConnectionException(self.connection_error_msg()) from None
|
|
1210
|
+
|
|
1099
1211
|
def insert_records_of_one_device(
|
|
1100
1212
|
self, device_id, times_list, measurements_list, types_list, values_list
|
|
1101
1213
|
):
|
|
@@ -1312,13 +1424,27 @@ class Session(object):
|
|
|
1312
1424
|
def gen_insert_tablet_req(self, tablet, is_aligned=False):
|
|
1313
1425
|
return TSInsertTabletReq(
|
|
1314
1426
|
self.__session_id,
|
|
1315
|
-
tablet.
|
|
1427
|
+
tablet.get_insert_target_name(),
|
|
1428
|
+
tablet.get_measurements(),
|
|
1429
|
+
tablet.get_binary_values(),
|
|
1430
|
+
tablet.get_binary_timestamps(),
|
|
1431
|
+
tablet.get_data_types(),
|
|
1432
|
+
tablet.get_row_number(),
|
|
1433
|
+
is_aligned,
|
|
1434
|
+
)
|
|
1435
|
+
|
|
1436
|
+
def gen_insert_relational_tablet_req(self, tablet, is_aligned=False):
|
|
1437
|
+
return TSInsertTabletReq(
|
|
1438
|
+
self.__session_id,
|
|
1439
|
+
tablet.get_insert_target_name(),
|
|
1316
1440
|
tablet.get_measurements(),
|
|
1317
1441
|
tablet.get_binary_values(),
|
|
1318
1442
|
tablet.get_binary_timestamps(),
|
|
1319
1443
|
tablet.get_data_types(),
|
|
1320
1444
|
tablet.get_row_number(),
|
|
1321
1445
|
is_aligned,
|
|
1446
|
+
True,
|
|
1447
|
+
tablet.get_column_categories(),
|
|
1322
1448
|
)
|
|
1323
1449
|
|
|
1324
1450
|
def gen_insert_tablets_req(self, tablet_lst, is_aligned=False):
|
|
@@ -1329,7 +1455,7 @@ class Session(object):
|
|
|
1329
1455
|
type_lst = []
|
|
1330
1456
|
size_lst = []
|
|
1331
1457
|
for tablet in tablet_lst:
|
|
1332
|
-
device_id_lst.append(tablet.
|
|
1458
|
+
device_id_lst.append(tablet.get_insert_target_name())
|
|
1333
1459
|
measurements_lst.append(tablet.get_measurements())
|
|
1334
1460
|
values_lst.append(tablet.get_binary_values())
|
|
1335
1461
|
timestamps_lst.append(tablet.get_binary_timestamps())
|
|
@@ -1402,6 +1528,18 @@ class Session(object):
|
|
|
1402
1528
|
else:
|
|
1403
1529
|
raise IoTDBConnectionException(self.connection_error_msg()) from None
|
|
1404
1530
|
|
|
1531
|
+
previous_db = self.database
|
|
1532
|
+
if resp.database is not None:
|
|
1533
|
+
self.database = resp.database
|
|
1534
|
+
if previous_db != self.database and self.__endpoint_to_connection is not None:
|
|
1535
|
+
iterator = iter(self.__endpoint_to_connection.items())
|
|
1536
|
+
for entry in list(iterator):
|
|
1537
|
+
endpoint, connection = entry
|
|
1538
|
+
if connection != self.__default_connection:
|
|
1539
|
+
try:
|
|
1540
|
+
connection.change_database(sql)
|
|
1541
|
+
except Exception as e:
|
|
1542
|
+
self.__endpoint_to_connection.pop(endpoint)
|
|
1405
1543
|
return Session.verify_success(resp.status)
|
|
1406
1544
|
|
|
1407
1545
|
def execute_statement(self, sql: str, timeout=0):
|
|
@@ -1563,7 +1701,7 @@ class Session(object):
|
|
|
1563
1701
|
):
|
|
1564
1702
|
return 0
|
|
1565
1703
|
|
|
1566
|
-
raise RuntimeError(
|
|
1704
|
+
raise RuntimeError(f"{status.code}: {status.message}")
|
|
1567
1705
|
|
|
1568
1706
|
@staticmethod
|
|
1569
1707
|
def verify_success_by_list(status_list: list):
|
|
@@ -1571,14 +1709,15 @@ class Session(object):
|
|
|
1571
1709
|
verify success of operation
|
|
1572
1710
|
:param status_list: execution result status
|
|
1573
1711
|
"""
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1712
|
+
error_messages = [
|
|
1713
|
+
status.message
|
|
1714
|
+
for status in status_list
|
|
1715
|
+
if status.code
|
|
1716
|
+
not in {Session.SUCCESS_STATUS, Session.REDIRECTION_RECOMMEND}
|
|
1717
|
+
]
|
|
1718
|
+
if error_messages:
|
|
1719
|
+
message = f"{Session.MULTIPLE_ERROR}: {'; '.join(error_messages)}"
|
|
1720
|
+
raise RuntimeError(message)
|
|
1582
1721
|
|
|
1583
1722
|
@staticmethod
|
|
1584
1723
|
def verify_success_with_redirection(status: TSStatus):
|
|
@@ -1879,6 +2018,49 @@ class Session(object):
|
|
|
1879
2018
|
)
|
|
1880
2019
|
return request
|
|
1881
2020
|
|
|
2021
|
+
def __has_none_value(self, values_list) -> bool:
|
|
2022
|
+
for item in values_list:
|
|
2023
|
+
if isinstance(item, list):
|
|
2024
|
+
if self.__has_none_value(item):
|
|
2025
|
+
return True
|
|
2026
|
+
elif item is None:
|
|
2027
|
+
return True
|
|
2028
|
+
return False
|
|
2029
|
+
|
|
2030
|
+
@staticmethod
|
|
2031
|
+
def __filter_lists_by_values(
|
|
2032
|
+
device_lst, time_lst, measurements_lst, types_lst, values_lst
|
|
2033
|
+
):
|
|
2034
|
+
filtered_devices = []
|
|
2035
|
+
filtered_times = []
|
|
2036
|
+
filtered_measurements = []
|
|
2037
|
+
filtered_types = []
|
|
2038
|
+
filtered_values = []
|
|
2039
|
+
|
|
2040
|
+
for device, time_, measurements, types, values in zip(
|
|
2041
|
+
device_lst, time_lst, measurements_lst, types_lst, values_lst
|
|
2042
|
+
):
|
|
2043
|
+
filtered_row = [
|
|
2044
|
+
(m, t, v)
|
|
2045
|
+
for m, t, v in zip(measurements, types, values)
|
|
2046
|
+
if v is not None
|
|
2047
|
+
]
|
|
2048
|
+
if filtered_row:
|
|
2049
|
+
f_measurements, f_types, f_values = zip(*filtered_row)
|
|
2050
|
+
filtered_measurements.append(list(f_measurements))
|
|
2051
|
+
filtered_types.append(list(f_types))
|
|
2052
|
+
filtered_values.append(list(f_values))
|
|
2053
|
+
filtered_devices.append(device)
|
|
2054
|
+
filtered_times.append(time_)
|
|
2055
|
+
|
|
2056
|
+
return (
|
|
2057
|
+
filtered_devices,
|
|
2058
|
+
filtered_times,
|
|
2059
|
+
filtered_measurements,
|
|
2060
|
+
filtered_types,
|
|
2061
|
+
filtered_values,
|
|
2062
|
+
)
|
|
2063
|
+
|
|
1882
2064
|
def create_schema_template(self, template: Template):
|
|
1883
2065
|
warnings.warn(
|
|
1884
2066
|
"The APIs about template are deprecated and will be removed in future versions. Use sql instead.",
|
|
@@ -2290,6 +2472,17 @@ class SessionConnection(object):
|
|
|
2290
2472
|
self.session_id = session_id
|
|
2291
2473
|
self.statement_id = statement_id
|
|
2292
2474
|
|
|
2475
|
+
def change_database(self, sql):
|
|
2476
|
+
try:
|
|
2477
|
+
self.client.executeUpdateStatement(
|
|
2478
|
+
TSExecuteStatementReq(self.session_id, sql, self.statement_id)
|
|
2479
|
+
)
|
|
2480
|
+
except TTransport.TException as e:
|
|
2481
|
+
raise IoTDBConnectionException(
|
|
2482
|
+
"failed to change database",
|
|
2483
|
+
e,
|
|
2484
|
+
) from None
|
|
2485
|
+
|
|
2293
2486
|
def close_connection(self, req):
|
|
2294
2487
|
try:
|
|
2295
2488
|
self.client.closeSession(req)
|
|
@@ -27,6 +27,7 @@ DEFAULT_MULTIPIE = 5
|
|
|
27
27
|
DEFAULT_FETCH_SIZE = 5000
|
|
28
28
|
DEFAULT_MAX_RETRY = 3
|
|
29
29
|
DEFAULT_TIME_ZONE = "UTC+8"
|
|
30
|
+
SQL_DIALECT = "tree"
|
|
30
31
|
logger = logging.getLogger("IoTDB")
|
|
31
32
|
|
|
32
33
|
|
|
@@ -42,6 +43,7 @@ class PoolConfig(object):
|
|
|
42
43
|
time_zone: str = DEFAULT_TIME_ZONE,
|
|
43
44
|
max_retry: int = DEFAULT_MAX_RETRY,
|
|
44
45
|
enable_compression: bool = False,
|
|
46
|
+
enable_redirection: bool = True,
|
|
45
47
|
use_ssl: bool = False,
|
|
46
48
|
ca_certs: str = None,
|
|
47
49
|
connection_timeout_in_ms: int = None,
|
|
@@ -61,6 +63,7 @@ class PoolConfig(object):
|
|
|
61
63
|
self.time_zone = time_zone
|
|
62
64
|
self.max_retry = max_retry
|
|
63
65
|
self.enable_compression = enable_compression
|
|
66
|
+
self.enable_redirection = enable_redirection
|
|
64
67
|
self.use_ssl = use_ssl
|
|
65
68
|
self.ca_certs = ca_certs
|
|
66
69
|
self.connection_timeout_in_ms = connection_timeout_in_ms
|
|
@@ -77,6 +80,8 @@ class SessionPool(object):
|
|
|
77
80
|
self.__queue = Queue(max_pool_size)
|
|
78
81
|
self.__lock = Lock()
|
|
79
82
|
self.__closed = False
|
|
83
|
+
self.sql_dialect = SQL_DIALECT
|
|
84
|
+
self.database = None
|
|
80
85
|
|
|
81
86
|
def __construct_session(self) -> Session:
|
|
82
87
|
if len(self.__pool_config.node_urls) > 0:
|
|
@@ -86,10 +91,13 @@ class SessionPool(object):
|
|
|
86
91
|
self.__pool_config.password,
|
|
87
92
|
self.__pool_config.fetch_size,
|
|
88
93
|
self.__pool_config.time_zone,
|
|
94
|
+
enable_redirection=self.__pool_config.enable_redirection,
|
|
89
95
|
use_ssl=self.__pool_config.use_ssl,
|
|
90
96
|
ca_certs=self.__pool_config.ca_certs,
|
|
91
97
|
connection_timeout_in_ms=self.__pool_config.connection_timeout_in_ms,
|
|
92
98
|
)
|
|
99
|
+
session.sql_dialect = self.sql_dialect
|
|
100
|
+
session.database = self.database
|
|
93
101
|
|
|
94
102
|
else:
|
|
95
103
|
session = Session(
|
|
@@ -99,10 +107,13 @@ class SessionPool(object):
|
|
|
99
107
|
self.__pool_config.password,
|
|
100
108
|
self.__pool_config.fetch_size,
|
|
101
109
|
self.__pool_config.time_zone,
|
|
110
|
+
enable_redirection=self.__pool_config.enable_redirection,
|
|
102
111
|
use_ssl=self.__pool_config.use_ssl,
|
|
103
112
|
ca_certs=self.__pool_config.ca_certs,
|
|
104
113
|
connection_timeout_in_ms=self.__pool_config.connection_timeout_in_ms,
|
|
105
114
|
)
|
|
115
|
+
session.sql_dialect = self.sql_dialect
|
|
116
|
+
session.database = self.database
|
|
106
117
|
|
|
107
118
|
session.open(self.__pool_config.enable_compression)
|
|
108
119
|
return session
|
|
@@ -114,6 +125,7 @@ class SessionPool(object):
|
|
|
114
125
|
return q
|
|
115
126
|
|
|
116
127
|
def get_session(self) -> Session:
|
|
128
|
+
|
|
117
129
|
if self.__closed:
|
|
118
130
|
raise ConnectionError("SessionPool has already been closed.")
|
|
119
131
|
|
|
@@ -148,6 +160,7 @@ class SessionPool(object):
|
|
|
148
160
|
return session
|
|
149
161
|
|
|
150
162
|
def put_back(self, session: Session):
|
|
163
|
+
|
|
151
164
|
if self.__closed:
|
|
152
165
|
raise ConnectionError(
|
|
153
166
|
"SessionPool has already been closed, please close the session manually."
|
|
@@ -160,6 +173,7 @@ class SessionPool(object):
|
|
|
160
173
|
self.__pool_size -= 1
|
|
161
174
|
|
|
162
175
|
def close(self):
|
|
176
|
+
|
|
163
177
|
with self.__lock:
|
|
164
178
|
while not self.__queue.empty():
|
|
165
179
|
session = self.__queue.get(block=False)
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
|
|
19
19
|
from sqlalchemy import types, util
|
|
20
20
|
from sqlalchemy.engine import default
|
|
21
|
+
from sqlalchemy.sql import text
|
|
21
22
|
from sqlalchemy.sql.sqltypes import String
|
|
22
23
|
|
|
23
24
|
from iotdb import dbapi
|
|
24
25
|
|
|
26
|
+
from .IoTDBIdentifierPreparer import IoTDBIdentifierPreparer
|
|
25
27
|
from .IoTDBSQLCompiler import IoTDBSQLCompiler
|
|
26
28
|
from .IoTDBTypeCompiler import IoTDBTypeCompiler
|
|
27
|
-
from .IoTDBIdentifierPreparer import IoTDBIdentifierPreparer
|
|
28
29
|
|
|
29
30
|
TYPES_MAP = {
|
|
30
31
|
"BOOLEAN": types.Boolean,
|
|
@@ -68,6 +69,10 @@ class IoTDBDialect(default.DefaultDialect):
|
|
|
68
69
|
opts.update({"sqlalchemy_mode": True})
|
|
69
70
|
return [[], opts]
|
|
70
71
|
|
|
72
|
+
@classmethod
|
|
73
|
+
def import_dbapi(cls):
|
|
74
|
+
return dbapi
|
|
75
|
+
|
|
71
76
|
@classmethod
|
|
72
77
|
def dbapi(cls):
|
|
73
78
|
return dbapi
|
|
@@ -79,17 +84,19 @@ class IoTDBDialect(default.DefaultDialect):
|
|
|
79
84
|
return table_name in self.get_table_names(connection, schema=schema)
|
|
80
85
|
|
|
81
86
|
def get_schema_names(self, connection, **kw):
|
|
82
|
-
cursor = connection.execute("SHOW DATABASES")
|
|
87
|
+
cursor = connection.execute(text("SHOW DATABASES"))
|
|
83
88
|
return [row[0] for row in cursor.fetchall()]
|
|
84
89
|
|
|
85
90
|
def get_table_names(self, connection, schema=None, **kw):
|
|
86
91
|
cursor = connection.execute(
|
|
87
|
-
"SHOW DEVICES %s.**" % (schema or self.default_schema_name)
|
|
92
|
+
text("SHOW DEVICES %s.**" % (schema or self.default_schema_name))
|
|
88
93
|
)
|
|
89
94
|
return [row[0].replace(schema + ".", "", 1) for row in cursor.fetchall()]
|
|
90
95
|
|
|
91
96
|
def get_columns(self, connection, table_name, schema=None, **kw):
|
|
92
|
-
cursor = connection.execute(
|
|
97
|
+
cursor = connection.execute(
|
|
98
|
+
text("SHOW TIMESERIES %s.%s.*" % (schema, table_name))
|
|
99
|
+
)
|
|
93
100
|
columns = [self._general_time_column_info()]
|
|
94
101
|
for row in cursor.fetchall():
|
|
95
102
|
columns.append(self._create_column_info(row, schema, table_name))
|