influxdb3-python 0.16.0__tar.gz → 0.18.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.
Files changed (80) hide show
  1. influxdb3_python-0.18.0/Examples/query_with_middleware.py +33 -0
  2. influxdb3_python-0.18.0/Examples/timeouts.py +83 -0
  3. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/PKG-INFO +79 -9
  4. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/README.md +76 -8
  5. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb3_python.egg-info/PKG-INFO +79 -9
  6. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb3_python.egg-info/SOURCES.txt +3 -0
  7. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb3_python.egg-info/requires.txt +2 -0
  8. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/__init__.py +189 -10
  9. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/exceptions/exceptions.py +32 -0
  10. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/query/query_api.py +65 -15
  11. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/version.py +1 -1
  12. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/_sync/api_client.py +1 -0
  13. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/write_api.py +120 -76
  14. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/service/write_service.py +75 -11
  15. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/setup.py +7 -1
  16. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_api_client.py +96 -0
  17. influxdb3_python-0.18.0/tests/test_flush.py +86 -0
  18. influxdb3_python-0.18.0/tests/test_influxdb_client_3.py +613 -0
  19. influxdb3_python-0.18.0/tests/test_influxdb_client_3_integration.py +681 -0
  20. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_query.py +76 -2
  21. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_write_local_server.py +86 -0
  22. influxdb3_python-0.16.0/tests/test_influxdb_client_3.py +0 -289
  23. influxdb3_python-0.16.0/tests/test_influxdb_client_3_integration.py +0 -249
  24. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/__init__.py +0 -0
  25. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/basic_ssl_example.py +0 -0
  26. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/batching_example.py +0 -0
  27. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/cloud_dedicated_query.py +0 -0
  28. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/cloud_dedicated_write.py +0 -0
  29. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/config.py +0 -0
  30. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/flight_options_example.py +0 -0
  31. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/handle_http_error.py +0 -0
  32. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/handle_query_error.py +0 -0
  33. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/pandas_write.py +0 -0
  34. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/query_async.py +0 -0
  35. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/Examples/query_type.py +0 -0
  36. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/LICENSE +0 -0
  37. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb3_python.egg-info/dependency_links.txt +0 -0
  38. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb3_python.egg-info/top_level.txt +0 -0
  39. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/exceptions/__init__.py +0 -0
  40. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/py.typed +0 -0
  41. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/query/__init__.py +0 -0
  42. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/read_file.py +0 -0
  43. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/__init__.py +0 -0
  44. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/_sync/__init__.py +0 -0
  45. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/_sync/rest.py +0 -0
  46. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/__init__.py +0 -0
  47. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/_base.py +0 -0
  48. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/influxdb_client.py +0 -0
  49. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/logging_handler.py +0 -0
  50. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/util/__init__.py +0 -0
  51. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/util/date_utils.py +0 -0
  52. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/util/date_utils_pandas.py +0 -0
  53. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/util/helpers.py +0 -0
  54. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/util/multiprocessing_helper.py +0 -0
  55. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/warnings.py +0 -0
  56. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/write/__init__.py +0 -0
  57. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/write/dataframe_serializer.py +0 -0
  58. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/write/point.py +0 -0
  59. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/write/polars_dataframe_serializer.py +0 -0
  60. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/client/write/retry.py +0 -0
  61. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/configuration.py +0 -0
  62. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/domain/__init__.py +0 -0
  63. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/domain/write_precision.py +0 -0
  64. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/domain/write_precision_converter.py +0 -0
  65. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/extras.py +0 -0
  66. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/rest.py +0 -0
  67. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/service/__init__.py +0 -0
  68. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/service/_base_service.py +0 -0
  69. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/service/signin_service.py +0 -0
  70. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/influxdb_client_3/write_client/service/signout_service.py +0 -0
  71. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/pyproject.toml +0 -0
  72. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/setup.cfg +0 -0
  73. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_dataframe_serializer.py +0 -0
  74. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_date_helper.py +0 -0
  75. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_deep_merge.py +0 -0
  76. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_merge_options.py +0 -0
  77. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_point.py +0 -0
  78. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_polars.py +0 -0
  79. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_write_file.py +0 -0
  80. {influxdb3_python-0.16.0 → influxdb3_python-0.18.0}/tests/test_write_precision_converter.py +0 -0
@@ -0,0 +1,33 @@
1
+ from pyarrow import flight
2
+
3
+ from config import Config
4
+ from influxdb_client_3 import InfluxDBClient3, flight_client_options
5
+
6
+
7
+ # This middleware will add an additional attribute `some-attribute` to the header
8
+ class ModifyHeaderClientMiddleware(flight.ClientMiddleware):
9
+ def sending_headers(self):
10
+ return {
11
+ "some-attribute": "some-value",
12
+ }
13
+
14
+ def received_headers(self, headers):
15
+ pass
16
+
17
+
18
+ class ModifyHeaderClientMiddlewareFactory(flight.ClientMiddlewareFactory):
19
+ def start_call(self, info):
20
+ return ModifyHeaderClientMiddleware()
21
+
22
+
23
+ config = Config()
24
+ middleware = [ModifyHeaderClientMiddlewareFactory()]
25
+ client = InfluxDBClient3(
26
+ host=config.host,
27
+ token=config.token,
28
+ database=config.database,
29
+ flight_client_options=flight_client_options(middleware=middleware)
30
+ )
31
+
32
+ df = client.query(query="select * from cpu11 limit 10", mode="pandas")
33
+ print(len(df))
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env python3
2
+ import sys
3
+ import time
4
+
5
+ from influxdb_client_3 import InfluxDBClient3, write_client_options
6
+
7
+ """
8
+ This example shows how to set query and write timeouts.
9
+ They can be set directly using arguments (write_timeout, query_timeout) in the client constructor.
10
+ They can also be overridden in write and query calls.
11
+
12
+ To trigger timeout and deadline expired exceptions, reset the timeout values in the examples or
13
+ supply new values as command line parameters.
14
+
15
+ Be sure to update the host, token a database values below, before running this example.
16
+ """
17
+
18
+ DEFAULT_WRITE_TIMEOUT = 30_000 # in milliseconds
19
+ DEFAULT_QUERY_TIMEOUT = 120_000 # in milliseconds
20
+ DEFAULT_HOST = 'http://localhost:8181'
21
+ DEFAULT_TOKEN = 'my-token'
22
+ DEFAULT_DATABASE = 'test-data'
23
+
24
+
25
+ def handle_write_error_cb(rd, rt, rx):
26
+ print(f"Got a write error: {rd}, {rt}, {rx}")
27
+
28
+
29
+ def main(w_to: int, q_to: int) -> None:
30
+ print(f"main {w_to}, {q_to}")
31
+ lp_data = "timeout_example,location=terra fVal=3.14,iVal=42i"
32
+ with InfluxDBClient3(
33
+ host=DEFAULT_HOST,
34
+ token=DEFAULT_TOKEN,
35
+ database=DEFAULT_DATABASE,
36
+ write_timeout=w_to,
37
+ query_timeout=q_to,
38
+ write_client_options=write_client_options(
39
+ error_handler=handle_write_error_cb
40
+ )
41
+ ) as client:
42
+
43
+ try:
44
+ # write with write timeout set in client
45
+ client.write(record=lp_data)
46
+ print("First write OK.")
47
+ time.sleep(1)
48
+
49
+ # write overriding client internal write timeout
50
+ # to force an exception try a _request_timeout value like 1 ms
51
+ client.write(record=lp_data, _request_timeout=9_000)
52
+ print("Second write OK.")
53
+ time.sleep(1)
54
+ except Exception as e:
55
+ print(f"Got exception on write: {e}")
56
+
57
+ sql = "SELECT * FROM timeout_example"
58
+
59
+ try:
60
+ # query using query timeout set in client
61
+ result = client.query(sql)
62
+ print("\nFirst query result\n", result)
63
+ time.sleep(1)
64
+
65
+ # query overriding client internal query timeout
66
+ # To force an exception try a timeout value like 0.001 seconds
67
+ result = client.query(sql, timeout=3.0)
68
+ print("\nSecond query result\n", result)
69
+ except Exception as e:
70
+ print(f"Got exception on query: {e}")
71
+
72
+
73
+ # To force timeout errors supply the corresponding command line arguments
74
+ if __name__ == "__main__":
75
+ w_ct = DEFAULT_WRITE_TIMEOUT
76
+ q_ct = DEFAULT_QUERY_TIMEOUT
77
+ for index, arg in enumerate(sys.argv):
78
+ if index == 1:
79
+ w_ct = int(arg)
80
+ if index == 2:
81
+ q_ct = int(arg)
82
+
83
+ main(w_ct, q_ct)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: influxdb3-python
3
- Version: 0.16.0
3
+ Version: 0.18.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
@@ -33,6 +33,8 @@ Provides-Extra: test
33
33
  Requires-Dist: pytest; extra == "test"
34
34
  Requires-Dist: pytest-cov; extra == "test"
35
35
  Requires-Dist: pytest-httpserver; extra == "test"
36
+ Requires-Dist: h2<5.0.0,>=4.0.0; extra == "test"
37
+ Requires-Dist: cryptography>=3.4.0; extra == "test"
36
38
  Dynamic: author
37
39
  Dynamic: author-email
38
40
  Dynamic: classifier
@@ -51,6 +53,9 @@ Dynamic: summary
51
53
  </p>
52
54
 
53
55
  <p align="center">
56
+ <a href="https://influxdb3-python.readthedocs.io/en/latest/">
57
+ <img src="https://img.shields.io/readthedocs/influxdb3-python/latest" alt="Readthedocs document">
58
+ </a>
54
59
  <a href="https://pypi.org/project/influxdb3-python/">
55
60
  <img src="https://img.shields.io/pypi/v/influxdb3-python.svg" alt="PyPI version">
56
61
  </a>
@@ -181,14 +186,46 @@ print(f'DONE writing from csv in {callback.write_count} batch(es)')
181
186
 
182
187
  ```
183
188
 
184
- ### Pandas DF
189
+ ### Pandas DataFrame
185
190
  ```python
186
- client._write_api.write(bucket="pokemon-codex", record=pd_df, data_frame_measurement_name='caught', data_frame_tag_columns=['trainer', 'id', 'num'], data_frame_timestamp_column='timestamp')
191
+ import pandas as pd
192
+
193
+ # Create a DataFrame with a timestamp column
194
+ df = pd.DataFrame({
195
+ 'time': pd.to_datetime(['2024-01-01', '2024-01-02', '2024-01-03']),
196
+ 'trainer': ['Ash', 'Misty', 'Brock'],
197
+ 'pokemon_id': [25, 120, 74],
198
+ 'pokemon_name': ['Pikachu', 'Staryu', 'Geodude']
199
+ })
200
+
201
+ # Write the DataFrame - timestamp_column is required for consistency
202
+ client.write_dataframe(
203
+ df,
204
+ measurement='caught',
205
+ timestamp_column='time',
206
+ tags=['trainer', 'pokemon_id']
207
+ )
187
208
  ```
188
209
 
189
- ### Polars DF
210
+ ### Polars DataFrame
190
211
  ```python
191
- 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')
212
+ import polars as pl
213
+
214
+ # Create a DataFrame with a timestamp column
215
+ df = pl.DataFrame({
216
+ 'time': ['2024-01-01T00:00:00Z', '2024-01-02T00:00:00Z'],
217
+ 'trainer': ['Ash', 'Misty'],
218
+ 'pokemon_id': [25, 120],
219
+ 'pokemon_name': ['Pikachu', 'Staryu']
220
+ })
221
+
222
+ # Write the DataFrame - same API works for both pandas and polars
223
+ client.write_dataframe(
224
+ df,
225
+ measurement='caught',
226
+ timestamp_column='time',
227
+ tags=['trainer', 'pokemon_id']
228
+ )
192
229
  ```
193
230
 
194
231
  ## Querying
@@ -201,6 +238,15 @@ table = reader.read_all()
201
238
  print(table.to_pandas().to_markdown())
202
239
  ```
203
240
 
241
+ ### Querying to DataFrame
242
+ ```python
243
+ # Query directly to a pandas DataFrame (default)
244
+ df = client.query_dataframe("SELECT * FROM caught WHERE trainer = 'Ash'")
245
+
246
+ # Query to a polars DataFrame
247
+ df = client.query_dataframe("SELECT * FROM caught", frame_type="polars")
248
+ ```
249
+
204
250
  ### Querying with influxql
205
251
  ```python
206
252
  query = "select * from measurement"
@@ -210,9 +256,32 @@ print(table.to_pandas().to_markdown())
210
256
  ```
211
257
 
212
258
  ### gRPC compression
213
- The Python client supports gRPC response compression.
214
- If the server chooses to compress query responses (e.g., with gzip), the client
215
- will automatically decompress them — no extra configuration is required.
259
+
260
+ #### Request compression
261
+
262
+ Request compression is not supported by InfluxDB 3 — the client sends uncompressed requests.
263
+
264
+ #### Response compression
265
+
266
+ Response compression is enabled by default. The client sends the `grpc-accept-encoding: identity, deflate, gzip`
267
+ header, and the server returns gzip-compressed responses (if supported). The client automatically
268
+ decompresses them — no configuration required.
269
+
270
+ To **disable response compression**:
271
+
272
+ ```python
273
+ # Via constructor parameter
274
+ client = InfluxDBClient3(
275
+ host="your-host",
276
+ token="your-token",
277
+ database="your-database",
278
+ disable_grpc_compression=True
279
+ )
280
+
281
+ # Or via environment variable
282
+ # INFLUX_DISABLE_GRPC_COMPRESSION=true
283
+ client = InfluxDBClient3.from_env()
284
+ ```
216
285
 
217
286
  ## Windows Users
218
287
  Currently, Windows users require an extra installation when querying via Flight natively. This is due to the fact gRPC cannot locate Windows root certificates. To work around this please follow these steps:
@@ -245,7 +314,8 @@ table = client.query(
245
314
 
246
315
  print(table.to_pandas())
247
316
  ```
248
- You may also include your own root certificate via this manor aswell.
317
+
318
+ You may include your own root certificate in this manner as well.
249
319
 
250
320
  If connecting to InfluxDB fails with error `DNS resolution failed` when using domain name, example `www.mydomain.com`, then try to set environment variable `GRPC_DNS_RESOLVER=native` to see if it works.
251
321
 
@@ -4,6 +4,9 @@
4
4
  </p>
5
5
 
6
6
  <p align="center">
7
+ <a href="https://influxdb3-python.readthedocs.io/en/latest/">
8
+ <img src="https://img.shields.io/readthedocs/influxdb3-python/latest" alt="Readthedocs document">
9
+ </a>
7
10
  <a href="https://pypi.org/project/influxdb3-python/">
8
11
  <img src="https://img.shields.io/pypi/v/influxdb3-python.svg" alt="PyPI version">
9
12
  </a>
@@ -134,14 +137,46 @@ print(f'DONE writing from csv in {callback.write_count} batch(es)')
134
137
 
135
138
  ```
136
139
 
137
- ### Pandas DF
140
+ ### Pandas DataFrame
138
141
  ```python
139
- client._write_api.write(bucket="pokemon-codex", record=pd_df, data_frame_measurement_name='caught', data_frame_tag_columns=['trainer', 'id', 'num'], data_frame_timestamp_column='timestamp')
142
+ import pandas as pd
143
+
144
+ # Create a DataFrame with a timestamp column
145
+ df = pd.DataFrame({
146
+ 'time': pd.to_datetime(['2024-01-01', '2024-01-02', '2024-01-03']),
147
+ 'trainer': ['Ash', 'Misty', 'Brock'],
148
+ 'pokemon_id': [25, 120, 74],
149
+ 'pokemon_name': ['Pikachu', 'Staryu', 'Geodude']
150
+ })
151
+
152
+ # Write the DataFrame - timestamp_column is required for consistency
153
+ client.write_dataframe(
154
+ df,
155
+ measurement='caught',
156
+ timestamp_column='time',
157
+ tags=['trainer', 'pokemon_id']
158
+ )
140
159
  ```
141
160
 
142
- ### Polars DF
161
+ ### Polars DataFrame
143
162
  ```python
144
- 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')
163
+ import polars as pl
164
+
165
+ # Create a DataFrame with a timestamp column
166
+ df = pl.DataFrame({
167
+ 'time': ['2024-01-01T00:00:00Z', '2024-01-02T00:00:00Z'],
168
+ 'trainer': ['Ash', 'Misty'],
169
+ 'pokemon_id': [25, 120],
170
+ 'pokemon_name': ['Pikachu', 'Staryu']
171
+ })
172
+
173
+ # Write the DataFrame - same API works for both pandas and polars
174
+ client.write_dataframe(
175
+ df,
176
+ measurement='caught',
177
+ timestamp_column='time',
178
+ tags=['trainer', 'pokemon_id']
179
+ )
145
180
  ```
146
181
 
147
182
  ## Querying
@@ -154,6 +189,15 @@ table = reader.read_all()
154
189
  print(table.to_pandas().to_markdown())
155
190
  ```
156
191
 
192
+ ### Querying to DataFrame
193
+ ```python
194
+ # Query directly to a pandas DataFrame (default)
195
+ df = client.query_dataframe("SELECT * FROM caught WHERE trainer = 'Ash'")
196
+
197
+ # Query to a polars DataFrame
198
+ df = client.query_dataframe("SELECT * FROM caught", frame_type="polars")
199
+ ```
200
+
157
201
  ### Querying with influxql
158
202
  ```python
159
203
  query = "select * from measurement"
@@ -163,9 +207,32 @@ print(table.to_pandas().to_markdown())
163
207
  ```
164
208
 
165
209
  ### gRPC compression
166
- The Python client supports gRPC response compression.
167
- If the server chooses to compress query responses (e.g., with gzip), the client
168
- will automatically decompress them — no extra configuration is required.
210
+
211
+ #### Request compression
212
+
213
+ Request compression is not supported by InfluxDB 3 — the client sends uncompressed requests.
214
+
215
+ #### Response compression
216
+
217
+ Response compression is enabled by default. The client sends the `grpc-accept-encoding: identity, deflate, gzip`
218
+ header, and the server returns gzip-compressed responses (if supported). The client automatically
219
+ decompresses them — no configuration required.
220
+
221
+ To **disable response compression**:
222
+
223
+ ```python
224
+ # Via constructor parameter
225
+ client = InfluxDBClient3(
226
+ host="your-host",
227
+ token="your-token",
228
+ database="your-database",
229
+ disable_grpc_compression=True
230
+ )
231
+
232
+ # Or via environment variable
233
+ # INFLUX_DISABLE_GRPC_COMPRESSION=true
234
+ client = InfluxDBClient3.from_env()
235
+ ```
169
236
 
170
237
  ## Windows Users
171
238
  Currently, Windows users require an extra installation when querying via Flight natively. This is due to the fact gRPC cannot locate Windows root certificates. To work around this please follow these steps:
@@ -198,7 +265,8 @@ table = client.query(
198
265
 
199
266
  print(table.to_pandas())
200
267
  ```
201
- You may also include your own root certificate via this manor aswell.
268
+
269
+ You may include your own root certificate in this manner as well.
202
270
 
203
271
  If connecting to InfluxDB fails with error `DNS resolution failed` when using domain name, example `www.mydomain.com`, then try to set environment variable `GRPC_DNS_RESOLVER=native` to see if it works.
204
272
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: influxdb3-python
3
- Version: 0.16.0
3
+ Version: 0.18.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
@@ -33,6 +33,8 @@ Provides-Extra: test
33
33
  Requires-Dist: pytest; extra == "test"
34
34
  Requires-Dist: pytest-cov; extra == "test"
35
35
  Requires-Dist: pytest-httpserver; extra == "test"
36
+ Requires-Dist: h2<5.0.0,>=4.0.0; extra == "test"
37
+ Requires-Dist: cryptography>=3.4.0; extra == "test"
36
38
  Dynamic: author
37
39
  Dynamic: author-email
38
40
  Dynamic: classifier
@@ -51,6 +53,9 @@ Dynamic: summary
51
53
  </p>
52
54
 
53
55
  <p align="center">
56
+ <a href="https://influxdb3-python.readthedocs.io/en/latest/">
57
+ <img src="https://img.shields.io/readthedocs/influxdb3-python/latest" alt="Readthedocs document">
58
+ </a>
54
59
  <a href="https://pypi.org/project/influxdb3-python/">
55
60
  <img src="https://img.shields.io/pypi/v/influxdb3-python.svg" alt="PyPI version">
56
61
  </a>
@@ -181,14 +186,46 @@ print(f'DONE writing from csv in {callback.write_count} batch(es)')
181
186
 
182
187
  ```
183
188
 
184
- ### Pandas DF
189
+ ### Pandas DataFrame
185
190
  ```python
186
- client._write_api.write(bucket="pokemon-codex", record=pd_df, data_frame_measurement_name='caught', data_frame_tag_columns=['trainer', 'id', 'num'], data_frame_timestamp_column='timestamp')
191
+ import pandas as pd
192
+
193
+ # Create a DataFrame with a timestamp column
194
+ df = pd.DataFrame({
195
+ 'time': pd.to_datetime(['2024-01-01', '2024-01-02', '2024-01-03']),
196
+ 'trainer': ['Ash', 'Misty', 'Brock'],
197
+ 'pokemon_id': [25, 120, 74],
198
+ 'pokemon_name': ['Pikachu', 'Staryu', 'Geodude']
199
+ })
200
+
201
+ # Write the DataFrame - timestamp_column is required for consistency
202
+ client.write_dataframe(
203
+ df,
204
+ measurement='caught',
205
+ timestamp_column='time',
206
+ tags=['trainer', 'pokemon_id']
207
+ )
187
208
  ```
188
209
 
189
- ### Polars DF
210
+ ### Polars DataFrame
190
211
  ```python
191
- 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')
212
+ import polars as pl
213
+
214
+ # Create a DataFrame with a timestamp column
215
+ df = pl.DataFrame({
216
+ 'time': ['2024-01-01T00:00:00Z', '2024-01-02T00:00:00Z'],
217
+ 'trainer': ['Ash', 'Misty'],
218
+ 'pokemon_id': [25, 120],
219
+ 'pokemon_name': ['Pikachu', 'Staryu']
220
+ })
221
+
222
+ # Write the DataFrame - same API works for both pandas and polars
223
+ client.write_dataframe(
224
+ df,
225
+ measurement='caught',
226
+ timestamp_column='time',
227
+ tags=['trainer', 'pokemon_id']
228
+ )
192
229
  ```
193
230
 
194
231
  ## Querying
@@ -201,6 +238,15 @@ table = reader.read_all()
201
238
  print(table.to_pandas().to_markdown())
202
239
  ```
203
240
 
241
+ ### Querying to DataFrame
242
+ ```python
243
+ # Query directly to a pandas DataFrame (default)
244
+ df = client.query_dataframe("SELECT * FROM caught WHERE trainer = 'Ash'")
245
+
246
+ # Query to a polars DataFrame
247
+ df = client.query_dataframe("SELECT * FROM caught", frame_type="polars")
248
+ ```
249
+
204
250
  ### Querying with influxql
205
251
  ```python
206
252
  query = "select * from measurement"
@@ -210,9 +256,32 @@ print(table.to_pandas().to_markdown())
210
256
  ```
211
257
 
212
258
  ### gRPC compression
213
- The Python client supports gRPC response compression.
214
- If the server chooses to compress query responses (e.g., with gzip), the client
215
- will automatically decompress them — no extra configuration is required.
259
+
260
+ #### Request compression
261
+
262
+ Request compression is not supported by InfluxDB 3 — the client sends uncompressed requests.
263
+
264
+ #### Response compression
265
+
266
+ Response compression is enabled by default. The client sends the `grpc-accept-encoding: identity, deflate, gzip`
267
+ header, and the server returns gzip-compressed responses (if supported). The client automatically
268
+ decompresses them — no configuration required.
269
+
270
+ To **disable response compression**:
271
+
272
+ ```python
273
+ # Via constructor parameter
274
+ client = InfluxDBClient3(
275
+ host="your-host",
276
+ token="your-token",
277
+ database="your-database",
278
+ disable_grpc_compression=True
279
+ )
280
+
281
+ # Or via environment variable
282
+ # INFLUX_DISABLE_GRPC_COMPRESSION=true
283
+ client = InfluxDBClient3.from_env()
284
+ ```
216
285
 
217
286
  ## Windows Users
218
287
  Currently, Windows users require an extra installation when querying via Flight natively. This is due to the fact gRPC cannot locate Windows root certificates. To work around this please follow these steps:
@@ -245,7 +314,8 @@ table = client.query(
245
314
 
246
315
  print(table.to_pandas())
247
316
  ```
248
- You may also include your own root certificate via this manor aswell.
317
+
318
+ You may include your own root certificate in this manner as well.
249
319
 
250
320
  If connecting to InfluxDB fails with error `DNS resolution failed` when using domain name, example `www.mydomain.com`, then try to set environment variable `GRPC_DNS_RESOLVER=native` to see if it works.
251
321
 
@@ -14,6 +14,8 @@ Examples/handle_query_error.py
14
14
  Examples/pandas_write.py
15
15
  Examples/query_async.py
16
16
  Examples/query_type.py
17
+ Examples/query_with_middleware.py
18
+ Examples/timeouts.py
17
19
  influxdb3_python.egg-info/PKG-INFO
18
20
  influxdb3_python.egg-info/SOURCES.txt
19
21
  influxdb3_python.egg-info/dependency_links.txt
@@ -62,6 +64,7 @@ tests/test_api_client.py
62
64
  tests/test_dataframe_serializer.py
63
65
  tests/test_date_helper.py
64
66
  tests/test_deep_merge.py
67
+ tests/test_flush.py
65
68
  tests/test_influxdb_client_3.py
66
69
  tests/test_influxdb_client_3_integration.py
67
70
  tests/test_merge_options.py
@@ -18,3 +18,5 @@ polars
18
18
  pytest
19
19
  pytest-cov
20
20
  pytest-httpserver
21
+ h2<5.0.0,>=4.0.0
22
+ cryptography>=3.4.0