influxdb3-python 0.3.6__tar.gz → 0.5.0__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.
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/PKG-INFO +21 -13
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/README.md +14 -10
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb3_python.egg-info/PKG-INFO +21 -13
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb3_python.egg-info/SOURCES.txt +7 -1
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb3_python.egg-info/requires.txt +4 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/__init__.py +78 -50
- influxdb3_python-0.5.0/influxdb_client_3/py.typed +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/read_file.py +6 -4
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/_sync/api_client.py +8 -8
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/_base.py +4 -10
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/influxdb_client.py +0 -8
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/write/dataframe_serializer.py +46 -46
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/write_api.py +6 -6
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/setup.py +13 -5
- influxdb3_python-0.5.0/tests/test_dataframe_serializer.py +45 -0
- influxdb3_python-0.5.0/tests/test_deep_merge.py +54 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/tests/test_influxdb_client_3.py +4 -10
- influxdb3_python-0.5.0/tests/test_influxdb_client_3_integration.py +44 -0
- influxdb3_python-0.5.0/tests/test_merge_options.py +28 -0
- influxdb3_python-0.5.0/tests/test_query.py +53 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/LICENSE +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb3_python.egg-info/dependency_links.txt +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb3_python.egg-info/top_level.txt +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/__init__.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/_sync/__init__.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/_sync/rest.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/__init__.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/exceptions.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/logging_handler.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/util/__init__.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/util/date_utils.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/util/date_utils_pandas.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/util/helpers.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/util/multiprocessing_helper.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/warnings.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/write/__init__.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/write/point.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/write/retry.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/configuration.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/domain/__init__.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/domain/write_precision.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/extras.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/rest.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/service/__init__.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/service/_base_service.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/service/signin_service.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/service/signout_service.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/service/write_service.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/version.py +0 -0
- {influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: influxdb3-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Community Python client for InfluxDB 3.0
|
|
5
5
|
Home-page: https://github.com/InfluxCommunity/influxdb3-python
|
|
6
6
|
Author: InfluxData
|
|
@@ -8,11 +8,12 @@ Author-email: contact@influxdata.com
|
|
|
8
8
|
Classifier: Development Status :: 4 - Beta
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.8
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Requires-Python: >=3.8
|
|
16
17
|
Description-Content-Type: text/markdown
|
|
17
18
|
License-File: LICENSE
|
|
18
19
|
Requires-Dist: reactivex>=4.0.4
|
|
@@ -28,6 +29,9 @@ Requires-Dist: polars; extra == "polars"
|
|
|
28
29
|
Provides-Extra: dataframe
|
|
29
30
|
Requires-Dist: pandas; extra == "dataframe"
|
|
30
31
|
Requires-Dist: polars; extra == "dataframe"
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest; extra == "test"
|
|
34
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
31
35
|
|
|
32
36
|
<p align="center">
|
|
33
37
|
<img src="https://github.com/InfluxCommunity/influxdb3-python/blob/main/python-logo.png?raw=true" alt="Your Image" width="150px">
|
|
@@ -40,11 +44,14 @@ Requires-Dist: polars; extra == "dataframe"
|
|
|
40
44
|
<a href="https://pypi.org/project/influxdb3-python/">
|
|
41
45
|
<img src="https://img.shields.io/pypi/dm/influxdb3-python.svg" alt="PyPI downloads">
|
|
42
46
|
</a>
|
|
43
|
-
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/
|
|
44
|
-
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/
|
|
47
|
+
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/codeql-analysis.yml">
|
|
48
|
+
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/codeql-analysis.yml/badge.svg?branch=main" alt="CodeQL analysis">
|
|
45
49
|
</a>
|
|
46
|
-
|
|
47
|
-
<img src="https://
|
|
50
|
+
<a href="https://dl.circleci.com/status-badge/redirect/gh/InfluxCommunity/influxdb3-python/tree/main">
|
|
51
|
+
<img src="https://dl.circleci.com/status-badge/img/gh/InfluxCommunity/influxdb3-python/tree/main.svg?style=svg" alt="CircleCI">
|
|
52
|
+
</a>
|
|
53
|
+
<a href="https://codecov.io/gh/InfluxCommunity/influxdb3-python">
|
|
54
|
+
<img src="https://codecov.io/gh/InfluxCommunity/influxdb3-python/branch/main/graph/badge.svg" alt="Code Cov"/>
|
|
48
55
|
</a>
|
|
49
56
|
<a href="https://influxcommunity.slack.com">
|
|
50
57
|
<img src="https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social" alt="Community Slack">
|
|
@@ -56,11 +63,12 @@ Requires-Dist: polars; extra == "dataframe"
|
|
|
56
63
|
|
|
57
64
|
`influxdb_client_3` is a Python module that provides a simple and convenient way to interact with InfluxDB 3.0. This module supports both writing data to InfluxDB and querying data using the Flight client, which allows you to execute SQL and InfluxQL queries on InfluxDB 3.0.
|
|
58
65
|
|
|
66
|
+
We offer a ["Getting Started: InfluxDB 3.0 Python Client Library"](https://www.youtube.com/watch?v=tpdONTm1GC8) video that goes over how to use the library and goes over the examples.
|
|
59
67
|
## Dependencies
|
|
60
68
|
|
|
61
69
|
- `pyarrow` (automatically installed)
|
|
62
70
|
- `pandas` (optional)
|
|
63
|
-
|
|
71
|
+
|
|
64
72
|
|
|
65
73
|
## Installation
|
|
66
74
|
|
|
@@ -141,7 +149,7 @@ write_options = WriteOptions(batch_size=500,
|
|
|
141
149
|
wco = write_client_options(success_callback=callback.success,
|
|
142
150
|
error_callback=callback.error,
|
|
143
151
|
retry_callback=callback.retry,
|
|
144
|
-
|
|
152
|
+
write_options=write_options
|
|
145
153
|
)
|
|
146
154
|
|
|
147
155
|
with InfluxDBClient3.InfluxDBClient3(
|
|
@@ -154,11 +162,11 @@ with InfluxDBClient3.InfluxDBClient3(
|
|
|
154
162
|
client.write_file(
|
|
155
163
|
file='./out.csv',
|
|
156
164
|
timestamp_column='time', tag_columns=["provider", "machineID"])
|
|
157
|
-
|
|
165
|
+
|
|
158
166
|
client.write_file(
|
|
159
167
|
file='./out.json',
|
|
160
168
|
timestamp_column='time', tag_columns=["provider", "machineID"], date_unit='ns' )
|
|
161
|
-
|
|
169
|
+
|
|
162
170
|
|
|
163
171
|
```
|
|
164
172
|
|
|
@@ -172,7 +180,7 @@ client._write_api.write(bucket="pokemon-codex", record=pd_df, data_frame_measure
|
|
|
172
180
|
client._write_api.write(bucket="pokemon-codex", record=pl_df, data_frame_measurement_name='caught', data_frame_tag_columns=['trainer', 'id', 'num'], data_frame_timestamp_column='timestamp')
|
|
173
181
|
```
|
|
174
182
|
|
|
175
|
-
## Querying
|
|
183
|
+
## Querying
|
|
176
184
|
|
|
177
185
|
### Querying with SQL
|
|
178
186
|
```python
|
|
@@ -224,4 +232,4 @@ table = client.query(
|
|
|
224
232
|
|
|
225
233
|
print(table.to_pandas())
|
|
226
234
|
```
|
|
227
|
-
You may also include your own root certificate via this manor aswell.
|
|
235
|
+
You may also include your own root certificate via this manor aswell.
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
<a href="https://pypi.org/project/influxdb3-python/">
|
|
10
10
|
<img src="https://img.shields.io/pypi/dm/influxdb3-python.svg" alt="PyPI downloads">
|
|
11
11
|
</a>
|
|
12
|
-
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/
|
|
13
|
-
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/
|
|
12
|
+
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/codeql-analysis.yml">
|
|
13
|
+
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/codeql-analysis.yml/badge.svg?branch=main" alt="CodeQL analysis">
|
|
14
14
|
</a>
|
|
15
|
-
|
|
16
|
-
<img src="https://
|
|
15
|
+
<a href="https://dl.circleci.com/status-badge/redirect/gh/InfluxCommunity/influxdb3-python/tree/main">
|
|
16
|
+
<img src="https://dl.circleci.com/status-badge/img/gh/InfluxCommunity/influxdb3-python/tree/main.svg?style=svg" alt="CircleCI">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://codecov.io/gh/InfluxCommunity/influxdb3-python">
|
|
19
|
+
<img src="https://codecov.io/gh/InfluxCommunity/influxdb3-python/branch/main/graph/badge.svg" alt="Code Cov"/>
|
|
17
20
|
</a>
|
|
18
21
|
<a href="https://influxcommunity.slack.com">
|
|
19
22
|
<img src="https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social" alt="Community Slack">
|
|
@@ -25,11 +28,12 @@
|
|
|
25
28
|
|
|
26
29
|
`influxdb_client_3` is a Python module that provides a simple and convenient way to interact with InfluxDB 3.0. This module supports both writing data to InfluxDB and querying data using the Flight client, which allows you to execute SQL and InfluxQL queries on InfluxDB 3.0.
|
|
27
30
|
|
|
31
|
+
We offer a ["Getting Started: InfluxDB 3.0 Python Client Library"](https://www.youtube.com/watch?v=tpdONTm1GC8) video that goes over how to use the library and goes over the examples.
|
|
28
32
|
## Dependencies
|
|
29
33
|
|
|
30
34
|
- `pyarrow` (automatically installed)
|
|
31
35
|
- `pandas` (optional)
|
|
32
|
-
|
|
36
|
+
|
|
33
37
|
|
|
34
38
|
## Installation
|
|
35
39
|
|
|
@@ -110,7 +114,7 @@ write_options = WriteOptions(batch_size=500,
|
|
|
110
114
|
wco = write_client_options(success_callback=callback.success,
|
|
111
115
|
error_callback=callback.error,
|
|
112
116
|
retry_callback=callback.retry,
|
|
113
|
-
|
|
117
|
+
write_options=write_options
|
|
114
118
|
)
|
|
115
119
|
|
|
116
120
|
with InfluxDBClient3.InfluxDBClient3(
|
|
@@ -123,11 +127,11 @@ with InfluxDBClient3.InfluxDBClient3(
|
|
|
123
127
|
client.write_file(
|
|
124
128
|
file='./out.csv',
|
|
125
129
|
timestamp_column='time', tag_columns=["provider", "machineID"])
|
|
126
|
-
|
|
130
|
+
|
|
127
131
|
client.write_file(
|
|
128
132
|
file='./out.json',
|
|
129
133
|
timestamp_column='time', tag_columns=["provider", "machineID"], date_unit='ns' )
|
|
130
|
-
|
|
134
|
+
|
|
131
135
|
|
|
132
136
|
```
|
|
133
137
|
|
|
@@ -141,7 +145,7 @@ client._write_api.write(bucket="pokemon-codex", record=pd_df, data_frame_measure
|
|
|
141
145
|
client._write_api.write(bucket="pokemon-codex", record=pl_df, data_frame_measurement_name='caught', data_frame_tag_columns=['trainer', 'id', 'num'], data_frame_timestamp_column='timestamp')
|
|
142
146
|
```
|
|
143
147
|
|
|
144
|
-
## Querying
|
|
148
|
+
## Querying
|
|
145
149
|
|
|
146
150
|
### Querying with SQL
|
|
147
151
|
```python
|
|
@@ -193,4 +197,4 @@ table = client.query(
|
|
|
193
197
|
|
|
194
198
|
print(table.to_pandas())
|
|
195
199
|
```
|
|
196
|
-
You may also include your own root certificate via this manor aswell.
|
|
200
|
+
You may also include your own root certificate via this manor aswell.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: influxdb3-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Community Python client for InfluxDB 3.0
|
|
5
5
|
Home-page: https://github.com/InfluxCommunity/influxdb3-python
|
|
6
6
|
Author: InfluxData
|
|
@@ -8,11 +8,12 @@ Author-email: contact@influxdata.com
|
|
|
8
8
|
Classifier: Development Status :: 4 - Beta
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.8
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Requires-Python: >=3.8
|
|
16
17
|
Description-Content-Type: text/markdown
|
|
17
18
|
License-File: LICENSE
|
|
18
19
|
Requires-Dist: reactivex>=4.0.4
|
|
@@ -28,6 +29,9 @@ Requires-Dist: polars; extra == "polars"
|
|
|
28
29
|
Provides-Extra: dataframe
|
|
29
30
|
Requires-Dist: pandas; extra == "dataframe"
|
|
30
31
|
Requires-Dist: polars; extra == "dataframe"
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest; extra == "test"
|
|
34
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
31
35
|
|
|
32
36
|
<p align="center">
|
|
33
37
|
<img src="https://github.com/InfluxCommunity/influxdb3-python/blob/main/python-logo.png?raw=true" alt="Your Image" width="150px">
|
|
@@ -40,11 +44,14 @@ Requires-Dist: polars; extra == "dataframe"
|
|
|
40
44
|
<a href="https://pypi.org/project/influxdb3-python/">
|
|
41
45
|
<img src="https://img.shields.io/pypi/dm/influxdb3-python.svg" alt="PyPI downloads">
|
|
42
46
|
</a>
|
|
43
|
-
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/
|
|
44
|
-
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/
|
|
47
|
+
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/codeql-analysis.yml">
|
|
48
|
+
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/codeql-analysis.yml/badge.svg?branch=main" alt="CodeQL analysis">
|
|
45
49
|
</a>
|
|
46
|
-
|
|
47
|
-
<img src="https://
|
|
50
|
+
<a href="https://dl.circleci.com/status-badge/redirect/gh/InfluxCommunity/influxdb3-python/tree/main">
|
|
51
|
+
<img src="https://dl.circleci.com/status-badge/img/gh/InfluxCommunity/influxdb3-python/tree/main.svg?style=svg" alt="CircleCI">
|
|
52
|
+
</a>
|
|
53
|
+
<a href="https://codecov.io/gh/InfluxCommunity/influxdb3-python">
|
|
54
|
+
<img src="https://codecov.io/gh/InfluxCommunity/influxdb3-python/branch/main/graph/badge.svg" alt="Code Cov"/>
|
|
48
55
|
</a>
|
|
49
56
|
<a href="https://influxcommunity.slack.com">
|
|
50
57
|
<img src="https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social" alt="Community Slack">
|
|
@@ -56,11 +63,12 @@ Requires-Dist: polars; extra == "dataframe"
|
|
|
56
63
|
|
|
57
64
|
`influxdb_client_3` is a Python module that provides a simple and convenient way to interact with InfluxDB 3.0. This module supports both writing data to InfluxDB and querying data using the Flight client, which allows you to execute SQL and InfluxQL queries on InfluxDB 3.0.
|
|
58
65
|
|
|
66
|
+
We offer a ["Getting Started: InfluxDB 3.0 Python Client Library"](https://www.youtube.com/watch?v=tpdONTm1GC8) video that goes over how to use the library and goes over the examples.
|
|
59
67
|
## Dependencies
|
|
60
68
|
|
|
61
69
|
- `pyarrow` (automatically installed)
|
|
62
70
|
- `pandas` (optional)
|
|
63
|
-
|
|
71
|
+
|
|
64
72
|
|
|
65
73
|
## Installation
|
|
66
74
|
|
|
@@ -141,7 +149,7 @@ write_options = WriteOptions(batch_size=500,
|
|
|
141
149
|
wco = write_client_options(success_callback=callback.success,
|
|
142
150
|
error_callback=callback.error,
|
|
143
151
|
retry_callback=callback.retry,
|
|
144
|
-
|
|
152
|
+
write_options=write_options
|
|
145
153
|
)
|
|
146
154
|
|
|
147
155
|
with InfluxDBClient3.InfluxDBClient3(
|
|
@@ -154,11 +162,11 @@ with InfluxDBClient3.InfluxDBClient3(
|
|
|
154
162
|
client.write_file(
|
|
155
163
|
file='./out.csv',
|
|
156
164
|
timestamp_column='time', tag_columns=["provider", "machineID"])
|
|
157
|
-
|
|
165
|
+
|
|
158
166
|
client.write_file(
|
|
159
167
|
file='./out.json',
|
|
160
168
|
timestamp_column='time', tag_columns=["provider", "machineID"], date_unit='ns' )
|
|
161
|
-
|
|
169
|
+
|
|
162
170
|
|
|
163
171
|
```
|
|
164
172
|
|
|
@@ -172,7 +180,7 @@ client._write_api.write(bucket="pokemon-codex", record=pd_df, data_frame_measure
|
|
|
172
180
|
client._write_api.write(bucket="pokemon-codex", record=pl_df, data_frame_measurement_name='caught', data_frame_tag_columns=['trainer', 'id', 'num'], data_frame_timestamp_column='timestamp')
|
|
173
181
|
```
|
|
174
182
|
|
|
175
|
-
## Querying
|
|
183
|
+
## Querying
|
|
176
184
|
|
|
177
185
|
### Querying with SQL
|
|
178
186
|
```python
|
|
@@ -224,4 +232,4 @@ table = client.query(
|
|
|
224
232
|
|
|
225
233
|
print(table.to_pandas())
|
|
226
234
|
```
|
|
227
|
-
You may also include your own root certificate via this manor aswell.
|
|
235
|
+
You may also include your own root certificate via this manor aswell.
|
|
@@ -7,6 +7,7 @@ influxdb3_python.egg-info/dependency_links.txt
|
|
|
7
7
|
influxdb3_python.egg-info/requires.txt
|
|
8
8
|
influxdb3_python.egg-info/top_level.txt
|
|
9
9
|
influxdb_client_3/__init__.py
|
|
10
|
+
influxdb_client_3/py.typed
|
|
10
11
|
influxdb_client_3/read_file.py
|
|
11
12
|
influxdb_client_3/write_client/__init__.py
|
|
12
13
|
influxdb_client_3/write_client/configuration.py
|
|
@@ -39,4 +40,9 @@ influxdb_client_3/write_client/service/_base_service.py
|
|
|
39
40
|
influxdb_client_3/write_client/service/signin_service.py
|
|
40
41
|
influxdb_client_3/write_client/service/signout_service.py
|
|
41
42
|
influxdb_client_3/write_client/service/write_service.py
|
|
42
|
-
tests/
|
|
43
|
+
tests/test_dataframe_serializer.py
|
|
44
|
+
tests/test_deep_merge.py
|
|
45
|
+
tests/test_influxdb_client_3.py
|
|
46
|
+
tests/test_influxdb_client_3_integration.py
|
|
47
|
+
tests/test_merge_options.py
|
|
48
|
+
tests/test_query.py
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import json
|
|
2
|
+
import urllib.parse
|
|
3
|
+
|
|
2
4
|
import pyarrow as pa
|
|
3
|
-
from influxdb_client_3.write_client import InfluxDBClient as _InfluxDBClient, WriteOptions, Point
|
|
4
|
-
from influxdb_client_3.write_client.client.write_api import WriteApi as _WriteApi, SYNCHRONOUS, ASYNCHRONOUS, PointSettings
|
|
5
|
-
from influxdb_client_3.write_client.domain.write_precision import WritePrecision
|
|
6
|
-
from influxdb_client_3.write_client.client.exceptions import InfluxDBError
|
|
7
5
|
from pyarrow.flight import FlightClient, Ticket, FlightCallOptions
|
|
6
|
+
|
|
8
7
|
from influxdb_client_3.read_file import UploadFile
|
|
9
|
-
import
|
|
8
|
+
from influxdb_client_3.write_client import InfluxDBClient as _InfluxDBClient, WriteOptions, Point
|
|
9
|
+
from influxdb_client_3.write_client.client.exceptions import InfluxDBError
|
|
10
|
+
from influxdb_client_3.write_client.client.write_api import WriteApi as _WriteApi, SYNCHRONOUS, ASYNCHRONOUS, \
|
|
11
|
+
PointSettings
|
|
12
|
+
from influxdb_client_3.write_client.domain.write_precision import WritePrecision
|
|
13
|
+
|
|
10
14
|
try:
|
|
11
15
|
import polars as pl
|
|
16
|
+
|
|
12
17
|
polars = True
|
|
13
18
|
except ImportError:
|
|
14
19
|
polars = False
|
|
15
20
|
|
|
16
21
|
|
|
17
|
-
|
|
18
22
|
def write_client_options(**kwargs):
|
|
19
23
|
"""
|
|
20
24
|
Function for providing additional arguments for the WriteApi client.
|
|
@@ -24,9 +28,11 @@ def write_client_options(**kwargs):
|
|
|
24
28
|
"""
|
|
25
29
|
return kwargs
|
|
26
30
|
|
|
31
|
+
|
|
27
32
|
def default_client_options(**kwargs):
|
|
28
33
|
return kwargs
|
|
29
34
|
|
|
35
|
+
|
|
30
36
|
def flight_client_options(**kwargs):
|
|
31
37
|
"""
|
|
32
38
|
Function for providing additional arguments for the FlightClient.
|
|
@@ -36,6 +42,7 @@ def flight_client_options(**kwargs):
|
|
|
36
42
|
"""
|
|
37
43
|
return kwargs
|
|
38
44
|
|
|
45
|
+
|
|
39
46
|
def file_parser_options(**kwargs):
|
|
40
47
|
"""
|
|
41
48
|
Function for providing additional arguments for the file parser.
|
|
@@ -43,7 +50,7 @@ def file_parser_options(**kwargs):
|
|
|
43
50
|
:param kwargs: Additional arguments for the file parser.
|
|
44
51
|
:return: dict with the arguments.
|
|
45
52
|
"""
|
|
46
|
-
return kwargs
|
|
53
|
+
return kwargs
|
|
47
54
|
|
|
48
55
|
|
|
49
56
|
def _deep_merge(target, source):
|
|
@@ -62,11 +69,26 @@ def _deep_merge(target, source):
|
|
|
62
69
|
elif isinstance(target, list) and isinstance(source, list):
|
|
63
70
|
# If both target and source are lists, concatenate them
|
|
64
71
|
target.extend(source)
|
|
65
|
-
|
|
72
|
+
elif source is not None:
|
|
66
73
|
# For other types, simply replace the target with the source
|
|
67
74
|
target = source
|
|
68
75
|
return target
|
|
69
76
|
|
|
77
|
+
|
|
78
|
+
def _merge_options(defaults, exclude_keys=None, custom=None):
|
|
79
|
+
"""
|
|
80
|
+
Merge default option arguments with custom (user-provided) arguments,
|
|
81
|
+
excluding specific keys defined in exclude_keys.
|
|
82
|
+
"""
|
|
83
|
+
if custom is None or len(custom) == 0:
|
|
84
|
+
return defaults
|
|
85
|
+
|
|
86
|
+
if exclude_keys is None:
|
|
87
|
+
exclude_keys = []
|
|
88
|
+
|
|
89
|
+
return _deep_merge(defaults, {key: value for key, value in custom.items() if key not in exclude_keys})
|
|
90
|
+
|
|
91
|
+
|
|
70
92
|
class InfluxDBClient3:
|
|
71
93
|
def __init__(
|
|
72
94
|
self,
|
|
@@ -99,11 +121,12 @@ class InfluxDBClient3:
|
|
|
99
121
|
self._org = org if org is not None else "default"
|
|
100
122
|
self._database = database
|
|
101
123
|
self._token = token
|
|
102
|
-
self._write_client_options = write_client_options if write_client_options is not None
|
|
103
|
-
|
|
124
|
+
self._write_client_options = write_client_options if write_client_options is not None \
|
|
125
|
+
else default_client_options(write_options=SYNCHRONOUS)
|
|
126
|
+
|
|
104
127
|
# Parse the host input
|
|
105
128
|
parsed_url = urllib.parse.urlparse(host)
|
|
106
|
-
|
|
129
|
+
|
|
107
130
|
# Determine the protocol (scheme), hostname, and port
|
|
108
131
|
scheme = parsed_url.scheme if parsed_url.scheme else "https"
|
|
109
132
|
hostname = parsed_url.hostname if parsed_url.hostname else host
|
|
@@ -118,23 +141,15 @@ class InfluxDBClient3:
|
|
|
118
141
|
token=self._token,
|
|
119
142
|
org=self._org,
|
|
120
143
|
**kwargs)
|
|
121
|
-
|
|
144
|
+
|
|
122
145
|
self._write_api = _WriteApi(influxdb_client=self._client, **self._write_client_options)
|
|
123
146
|
self._flight_client_options = flight_client_options or {}
|
|
124
|
-
|
|
147
|
+
|
|
125
148
|
if query_port_overwrite is not None:
|
|
126
149
|
port = query_port_overwrite
|
|
127
150
|
self._flight_client = FlightClient(f"grpc+tls://{hostname}:{port}", **self._flight_client_options)
|
|
128
151
|
|
|
129
|
-
def
|
|
130
|
-
"""
|
|
131
|
-
Merge default option arguments with custom (user-provided) arguments.
|
|
132
|
-
"""
|
|
133
|
-
if len(custom) == 0:
|
|
134
|
-
return defaults
|
|
135
|
-
return _deep_merge(defaults, {key: value for key, value in custom.items()})
|
|
136
|
-
|
|
137
|
-
def write(self, record=None, database=None ,**kwargs):
|
|
152
|
+
def write(self, record=None, database=None, **kwargs):
|
|
138
153
|
"""
|
|
139
154
|
Write data to InfluxDB.
|
|
140
155
|
|
|
@@ -151,9 +166,9 @@ class InfluxDBClient3:
|
|
|
151
166
|
self._write_api.write(bucket=database, record=record, **kwargs)
|
|
152
167
|
except InfluxDBError as e:
|
|
153
168
|
raise e
|
|
154
|
-
|
|
155
169
|
|
|
156
|
-
def write_file(self, file, measurement_name=None, tag_columns=None, timestamp_column='time', database=None,
|
|
170
|
+
def write_file(self, file, measurement_name=None, tag_columns=None, timestamp_column='time', database=None,
|
|
171
|
+
file_parser_options=None, **kwargs):
|
|
157
172
|
"""
|
|
158
173
|
Write data from a file to InfluxDB.
|
|
159
174
|
|
|
@@ -177,10 +192,10 @@ class InfluxDBClient3:
|
|
|
177
192
|
try:
|
|
178
193
|
table = UploadFile(file, file_parser_options).load_file()
|
|
179
194
|
df = table.to_pandas() if isinstance(table, pa.Table) else table
|
|
180
|
-
self._process_dataframe(df, measurement_name, tag_columns or [], timestamp_column, database=database,
|
|
195
|
+
self._process_dataframe(df, measurement_name, tag_columns or [], timestamp_column, database=database,
|
|
196
|
+
**kwargs)
|
|
181
197
|
except Exception as e:
|
|
182
198
|
raise e
|
|
183
|
-
|
|
184
199
|
|
|
185
200
|
def _process_dataframe(self, df, measurement_name, tag_columns, timestamp_column, database, **kwargs):
|
|
186
201
|
# This function is factored out for clarity.
|
|
@@ -204,41 +219,53 @@ class InfluxDBClient3:
|
|
|
204
219
|
data_frame_measurement_name=measurement_name,
|
|
205
220
|
data_frame_tag_columns=tag_columns,
|
|
206
221
|
data_frame_timestamp_column=timestamp_column, **kwargs)
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
:param
|
|
216
|
-
:
|
|
217
|
-
:param mode: The mode
|
|
218
|
-
|
|
222
|
+
|
|
223
|
+
def query(self, query: str, language: str = "sql", mode: str = "all", database: str = None, **kwargs):
|
|
224
|
+
"""Query data from InfluxDB.
|
|
225
|
+
|
|
226
|
+
If you want to use query parameters, you can pass them as kwargs:
|
|
227
|
+
|
|
228
|
+
>>> client.query("select * from cpu where host=$host", query_parameters={"host": "server01"})
|
|
229
|
+
|
|
230
|
+
:param query: The query to execute on the database.
|
|
231
|
+
:param language: The query language to use. It should be one of "influxql" or "sql". Defaults to "sql".
|
|
232
|
+
:param mode: The mode to use for the query. It should be one of "all", "pandas", "polars", "chunk",
|
|
233
|
+
"reader" or "schema". Defaults to "all".
|
|
219
234
|
:param database: The database to query from. If not provided, uses the database provided during initialization.
|
|
220
|
-
:
|
|
221
|
-
|
|
222
|
-
:
|
|
235
|
+
:param kwargs: Additional arguments to pass to the ``FlightCallOptions headers``. For example, it can be used to
|
|
236
|
+
set up per request headers.
|
|
237
|
+
:keyword query_parameters: The query parameters to use in the query.
|
|
238
|
+
It should be a ``dictionary`` of key-value pairs.
|
|
239
|
+
:return: The query result in the specified mode.
|
|
223
240
|
"""
|
|
224
241
|
if mode == "polars" and polars is False:
|
|
225
242
|
raise ImportError("Polars is not installed. Please install it with `pip install polars`.")
|
|
226
|
-
|
|
227
|
-
|
|
228
243
|
|
|
229
244
|
if database is None:
|
|
230
245
|
database = self._database
|
|
231
|
-
|
|
246
|
+
|
|
232
247
|
try:
|
|
233
248
|
# Create an authorization header
|
|
234
249
|
optargs = {
|
|
235
250
|
"headers": [(b"authorization", f"Bearer {self._token}".encode('utf-8'))],
|
|
236
251
|
"timeout": 300
|
|
237
252
|
}
|
|
238
|
-
opts =
|
|
253
|
+
opts = _merge_options(optargs, exclude_keys=['query_parameters'], custom=kwargs)
|
|
239
254
|
_options = FlightCallOptions(**opts)
|
|
240
|
-
|
|
241
|
-
|
|
255
|
+
|
|
256
|
+
#
|
|
257
|
+
# Ticket data
|
|
258
|
+
#
|
|
259
|
+
ticket_data = {
|
|
260
|
+
"database": database,
|
|
261
|
+
"sql_query": query,
|
|
262
|
+
"query_type": language
|
|
263
|
+
}
|
|
264
|
+
# add query parameters
|
|
265
|
+
query_parameters = kwargs.get("query_parameters", None)
|
|
266
|
+
if query_parameters:
|
|
267
|
+
ticket_data["params"] = query_parameters
|
|
268
|
+
|
|
242
269
|
ticket = Ticket(json.dumps(ticket_data).encode('utf-8'))
|
|
243
270
|
flight_reader = self._flight_client.do_get(ticket, _options)
|
|
244
271
|
|
|
@@ -249,7 +276,7 @@ class InfluxDBClient3:
|
|
|
249
276
|
"chunk": lambda: flight_reader,
|
|
250
277
|
"reader": flight_reader.to_reader,
|
|
251
278
|
"schema": lambda: flight_reader.schema
|
|
252
|
-
|
|
279
|
+
|
|
253
280
|
}.get(mode, flight_reader.read_all)
|
|
254
281
|
|
|
255
282
|
return mode_func() if callable(mode_func) else mode_func
|
|
@@ -267,7 +294,8 @@ class InfluxDBClient3:
|
|
|
267
294
|
|
|
268
295
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
269
296
|
self.close()
|
|
270
|
-
|
|
297
|
+
|
|
298
|
+
|
|
271
299
|
__all__ = [
|
|
272
300
|
"InfluxDBClient3",
|
|
273
301
|
"Point",
|
|
File without changes
|
|
@@ -12,6 +12,7 @@ class UploadFile:
|
|
|
12
12
|
"""
|
|
13
13
|
Class for uploading and reading different types of files.
|
|
14
14
|
"""
|
|
15
|
+
|
|
15
16
|
def __init__(self, file, file_parser_options=None):
|
|
16
17
|
"""
|
|
17
18
|
Initialize an UploadFile instance.
|
|
@@ -44,7 +45,7 @@ class UploadFile:
|
|
|
44
45
|
else:
|
|
45
46
|
raise ValueError("Unsupported file type")
|
|
46
47
|
|
|
47
|
-
def load_feather(self, file
|
|
48
|
+
def load_feather(self, file):
|
|
48
49
|
"""
|
|
49
50
|
Load a Feather file.
|
|
50
51
|
|
|
@@ -99,6 +100,7 @@ class UploadFile:
|
|
|
99
100
|
try:
|
|
100
101
|
import pandas as pd
|
|
101
102
|
except ImportError:
|
|
102
|
-
raise ImportError("Pandas is required for write_file(). Please install it using 'pip install pandas' or
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
raise ImportError("Pandas is required for write_file(). Please install it using 'pip install pandas' or "
|
|
104
|
+
"'pip install influxdb3-python[pandas]'")
|
|
105
|
+
|
|
106
|
+
return pd.read_json(file, **self._kwargs)
|
{influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/_sync/api_client.py
RENAMED
|
@@ -267,7 +267,7 @@ class ApiClient(object):
|
|
|
267
267
|
if data is None:
|
|
268
268
|
return None
|
|
269
269
|
|
|
270
|
-
if
|
|
270
|
+
if klass is str:
|
|
271
271
|
if klass.startswith('list['):
|
|
272
272
|
sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
|
|
273
273
|
return [self.__deserialize(sub_data, sub_kls)
|
|
@@ -348,13 +348,13 @@ class ApiClient(object):
|
|
|
348
348
|
_preload_content, _request_timeout, urlopen_kw)
|
|
349
349
|
else:
|
|
350
350
|
thread = self.pool.apply_async(self.__call_api, (resource_path,
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
351
|
+
method, path_params, query_params,
|
|
352
|
+
header_params, body,
|
|
353
|
+
post_params, files,
|
|
354
|
+
response_type, auth_settings,
|
|
355
|
+
_return_http_data_only,
|
|
356
|
+
collection_formats,
|
|
357
|
+
_preload_content, _request_timeout, urlopen_kw))
|
|
358
358
|
return thread
|
|
359
359
|
|
|
360
360
|
def request(self, method, url, query_params=None, headers=None,
|
{influxdb3-python-0.3.6 → influxdb3_python-0.5.0}/influxdb_client_3/write_client/client/_base.py
RENAMED
|
@@ -5,16 +5,13 @@ import base64
|
|
|
5
5
|
import configparser
|
|
6
6
|
import logging
|
|
7
7
|
import os
|
|
8
|
-
from
|
|
9
|
-
from typing import List, Generator, Any, Union, Iterable, AsyncGenerator
|
|
10
|
-
|
|
11
|
-
from urllib3 import HTTPResponse
|
|
8
|
+
from typing import Iterable
|
|
12
9
|
|
|
10
|
+
from influxdb_client_3.write_client.client.write.dataframe_serializer import DataframeSerializer, \
|
|
11
|
+
PolarsDataframeSerializer
|
|
13
12
|
from influxdb_client_3.write_client.configuration import Configuration
|
|
14
|
-
from influxdb_client_3.write_client.service.write_service import WriteService
|
|
15
|
-
|
|
16
|
-
from influxdb_client_3.write_client.client.write.dataframe_serializer import DataframeSerializer, PolarsDataframeSerializer
|
|
17
13
|
from influxdb_client_3.write_client.rest import _UTF_8_encoding
|
|
14
|
+
from influxdb_client_3.write_client.service.write_service import WriteService
|
|
18
15
|
|
|
19
16
|
try:
|
|
20
17
|
import dataclasses
|
|
@@ -208,7 +205,6 @@ class _BaseClient(object):
|
|
|
208
205
|
profilers=profilers, **kwargs)
|
|
209
206
|
|
|
210
207
|
|
|
211
|
-
|
|
212
208
|
class _BaseWriteApi(object):
|
|
213
209
|
def __init__(self, influxdb_client, point_settings=None):
|
|
214
210
|
self._influxdb_client = influxdb_client
|
|
@@ -260,7 +256,6 @@ class _BaseWriteApi(object):
|
|
|
260
256
|
serializer = DataframeSerializer(record, self._point_settings, write_precision, **kwargs)
|
|
261
257
|
self._serialize(serializer.serialize(), write_precision, payload, **kwargs)
|
|
262
258
|
|
|
263
|
-
|
|
264
259
|
elif hasattr(record, "_asdict"):
|
|
265
260
|
# noinspection PyProtectedMember
|
|
266
261
|
self._serialize(record._asdict(), write_precision, payload, **kwargs)
|
|
@@ -271,7 +266,6 @@ class _BaseWriteApi(object):
|
|
|
271
266
|
self._serialize(item, write_precision, payload, **kwargs)
|
|
272
267
|
|
|
273
268
|
|
|
274
|
-
|
|
275
269
|
class _Configuration(Configuration):
|
|
276
270
|
def __init__(self):
|
|
277
271
|
Configuration.__init__(self)
|