influxdb3-python 0.19.0__tar.gz → 0.20.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 (86) hide show
  1. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/PKG-INFO +93 -3
  2. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/README.md +92 -2
  3. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb3_python.egg-info/PKG-INFO +93 -3
  4. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb3_python.egg-info/SOURCES.txt +5 -16
  5. influxdb3_python-0.20.0/influxdb3_python.egg-info/entry_points.txt +2 -0
  6. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb3_python.egg-info/top_level.txt +0 -1
  7. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/__init__.py +43 -18
  8. influxdb3_python-0.20.0/influxdb_client_3/__main__.py +5 -0
  9. influxdb3_python-0.20.0/influxdb_client_3/cli.py +211 -0
  10. influxdb3_python-0.20.0/influxdb_client_3/exceptions/__init__.py +4 -0
  11. influxdb3_python-0.20.0/influxdb_client_3/exceptions/exceptions.py +255 -0
  12. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/query/query_api.py +3 -1
  13. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/version.py +1 -1
  14. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/__init__.py +0 -3
  15. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/_sync/api_client.py +1 -21
  16. {influxdb3_python-0.19.0/influxdb_client_3/write_client/service → influxdb3_python-0.20.0/influxdb_client_3/write_client/client}/__init__.py +0 -2
  17. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/_base.py +2 -23
  18. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/influxdb_client.py +0 -10
  19. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/write/__init__.py +0 -2
  20. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/write_api.py +59 -11
  21. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/configuration.py +0 -25
  22. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/rest.py +0 -10
  23. influxdb3_python-0.20.0/influxdb_client_3/write_client/service/__init__.py +6 -0
  24. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/service/write_service.py +80 -34
  25. influxdb3_python-0.20.0/influxdb_client_3/write_client/write_defaults.py +6 -0
  26. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/setup.py +3 -0
  27. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_api_client.py +181 -4
  28. influxdb3_python-0.20.0/tests/test_cli.py +283 -0
  29. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_influxdb_client_3.py +86 -31
  30. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_influxdb_client_3_integration.py +46 -24
  31. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_polars.py +2 -0
  32. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_query.py +16 -0
  33. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_write_local_server.py +130 -10
  34. influxdb3_python-0.19.0/Examples/__init__.py +0 -1
  35. influxdb3_python-0.19.0/Examples/basic_ssl_example.py +0 -102
  36. influxdb3_python-0.19.0/Examples/batching_example.py +0 -140
  37. influxdb3_python-0.19.0/Examples/cloud_dedicated_query.py +0 -15
  38. influxdb3_python-0.19.0/Examples/cloud_dedicated_write.py +0 -48
  39. influxdb3_python-0.19.0/Examples/config.py +0 -12
  40. influxdb3_python-0.19.0/Examples/flight_options_example.py +0 -22
  41. influxdb3_python-0.19.0/Examples/handle_http_error.py +0 -42
  42. influxdb3_python-0.19.0/Examples/handle_query_error.py +0 -33
  43. influxdb3_python-0.19.0/Examples/pandas_write.py +0 -34
  44. influxdb3_python-0.19.0/Examples/query_async.py +0 -86
  45. influxdb3_python-0.19.0/Examples/query_type.py +0 -54
  46. influxdb3_python-0.19.0/Examples/query_with_middleware.py +0 -33
  47. influxdb3_python-0.19.0/Examples/timeouts.py +0 -83
  48. influxdb3_python-0.19.0/influxdb_client_3/exceptions/__init__.py +0 -3
  49. influxdb3_python-0.19.0/influxdb_client_3/exceptions/exceptions.py +0 -121
  50. influxdb3_python-0.19.0/influxdb_client_3/write_client/client/__init__.py +0 -8
  51. influxdb3_python-0.19.0/influxdb_client_3/write_client/service/signin_service.py +0 -129
  52. influxdb3_python-0.19.0/influxdb_client_3/write_client/service/signout_service.py +0 -124
  53. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/LICENSE +0 -0
  54. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb3_python.egg-info/dependency_links.txt +0 -0
  55. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb3_python.egg-info/requires.txt +0 -0
  56. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/py.typed +0 -0
  57. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/query/__init__.py +0 -0
  58. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/read_file.py +0 -0
  59. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/_sync/__init__.py +0 -0
  60. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/_sync/rest.py +0 -0
  61. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/logging_handler.py +0 -0
  62. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/util/__init__.py +0 -0
  63. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/util/date_utils.py +0 -0
  64. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/util/date_utils_pandas.py +0 -0
  65. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/util/helpers.py +0 -0
  66. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/util/multiprocessing_helper.py +0 -0
  67. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/warnings.py +0 -0
  68. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/write/dataframe_serializer.py +0 -0
  69. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/write/point.py +0 -0
  70. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/write/polars_dataframe_serializer.py +0 -0
  71. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/client/write/retry.py +0 -0
  72. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/domain/__init__.py +0 -0
  73. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/domain/write_precision.py +0 -0
  74. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/domain/write_precision_converter.py +0 -0
  75. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/extras.py +0 -0
  76. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/influxdb_client_3/write_client/service/_base_service.py +0 -0
  77. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/pyproject.toml +0 -0
  78. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/setup.cfg +0 -0
  79. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_dataframe_serializer.py +0 -0
  80. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_date_helper.py +0 -0
  81. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_deep_merge.py +0 -0
  82. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_flush.py +0 -0
  83. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_merge_options.py +0 -0
  84. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_point.py +0 -0
  85. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_write_file.py +0 -0
  86. {influxdb3_python-0.19.0 → influxdb3_python-0.20.0}/tests/test_write_precision_converter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: influxdb3-python
3
- Version: 0.19.0
3
+ Version: 0.20.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
@@ -96,12 +96,52 @@ You can install 'influxdb3-python' using `pip`:
96
96
  pip install influxdb3-python
97
97
  ```
98
98
 
99
- Note: This does not include Pandas support. If you would like to use key features such as `to_pandas()` and `write_file()` you will need to install `pandas` separately.
99
+ Note: This does not include Pandas support. If you would like to use key features such as `to_pandas()` and `write_file()`, or to use PyArrow data conversion methods with nanosecond timestamp precision, you will need to install `pandas` separately.
100
100
 
101
101
  *Note: Please make sure you are using 3.9 or above. For the best performance use 3.11+*
102
102
 
103
+ ## CLI (Agent-Friendly Query Tool)
104
+
105
+ This package includes an `influx3` CLI for read/query workflows.
106
+
107
+ ### Run a query
108
+
109
+ ```bash
110
+ influx3 query -d my_database "SELECT * FROM cpu LIMIT 5"
111
+ ```
112
+
113
+ By default, output is JSON to stdout.
114
+
115
+ ### Supported formats
116
+
117
+ - `json` (default)
118
+ - `jsonl`
119
+ - `csv`
120
+ - `pretty`
121
+
122
+ ```bash
123
+ influx3 query -d my_database --format csv "SELECT * FROM cpu LIMIT 5"
124
+ ```
125
+
126
+ ### Config precedence
127
+
128
+ Configuration values are resolved in this order:
129
+
130
+ 1. CLI flags
131
+ 2. `INFLUXDB3_*` environment variables
132
+ 3. legacy `INFLUX_*` environment variables
133
+ 4. built-in defaults (host defaults to `http://127.0.0.1:8181`)
134
+
135
+ Relevant environment variables:
136
+
137
+ - `INFLUXDB3_HOST_URL` (legacy fallback: `INFLUX_HOST`)
138
+ - `INFLUXDB3_DATABASE_NAME` (legacy fallback: `INFLUX_DATABASE`)
139
+ - `INFLUXDB3_AUTH_TOKEN` (legacy fallback: `INFLUX_TOKEN`)
140
+
103
141
  # Usage
104
- One of the easiest ways to get started is to checkout the ["Pokemon Trainer Cookbook"](https://github.com/InfluxCommunity/influxdb3-python/blob/main/Examples/pokemon-trainer/cookbook.ipynb). This scenario takes you through the basics of both the client library and Pyarrow.
142
+ One of the easiest ways to get started is to check out the ["Influxdb3 Python Basic Usage"](https://github.com/InfluxCommunity/influxdb3-python/blob/main/examples/jupyter/basic-write-query.ipynb) notebook. This scenario takes you through the core write and read APIs of the client library.
143
+
144
+ Additional examples independent of jupyter are detailed in the [`./examples`](./examples/README.md) directory.
105
145
 
106
146
  ## Importing the Module
107
147
  ```python
@@ -252,6 +292,56 @@ client.write_dataframe(
252
292
  )
253
293
  ```
254
294
 
295
+ ### Accept partial writes and inspect failed lines
296
+ `accept_partial` defaults to `True` and allows partial success when writing through the V3 API endpoint (`use_v2_api=False`) and a batch contains invalid lines.
297
+ On partial failure, the client raises `InfluxDBPartialWriteError` with structured `line_errors`.
298
+
299
+ ```python
300
+ from influxdb_client_3 import InfluxDBClient3
301
+ from influxdb_client_3.exceptions import InfluxDBPartialWriteError
302
+
303
+ client = InfluxDBClient3(
304
+ host="http://localhost:8181",
305
+ token="token",
306
+ database="db",
307
+ write_use_v2_api=False,
308
+ )
309
+ lp = "home,room=Sunroom temp=96 1735545600\nhome,room=Sunroom temp=\"hi\" 1735549200"
310
+
311
+ try:
312
+ client.write(lp) # accept_partial=True by default on V3 API endpoint
313
+ except InfluxDBPartialWriteError as e:
314
+ for line_err in e.line_errors:
315
+ print(f"line {line_err.line_number} failed: {line_err.error_message} ({line_err.original_line})")
316
+ ```
317
+
318
+ Disable partial writes:
319
+ ```python
320
+ client = InfluxDBClient3(
321
+ host="http://localhost:8181",
322
+ token="token",
323
+ database="db",
324
+ write_use_v2_api=False,
325
+ write_accept_partial=False,
326
+ )
327
+ ```
328
+
329
+ ### Compatibility with InfluxDB Clustered and InfluxDB Cloud Dedicated/Serverless
330
+ Writes use the V2 API endpoint by default, so no additional configuration is required for these products.
331
+
332
+ `use_v2_api` can be configured by:
333
+ - `WriteOptions(use_v2_api=False)` (for V3 API endpoint features)
334
+ - constructor kwarg: `write_use_v2_api=False`
335
+ - env var: `INFLUX_WRITE_USE_V2_API=false`
336
+
337
+ When `use_v2_api=True`:
338
+ - `accept_partial` is not used
339
+ - `no_sync=True` is invalid and rejected before dispatch with:
340
+ `invalid write options: no_sync cannot be used with use_v2_api`
341
+
342
+ To use `no_sync` or `accept_partial` controls, set `use_v2_api=False`
343
+ (for example with InfluxDB 3 Core/Enterprise).
344
+
255
345
  ## Querying
256
346
 
257
347
  ### Querying with SQL
@@ -47,12 +47,52 @@ You can install 'influxdb3-python' using `pip`:
47
47
  pip install influxdb3-python
48
48
  ```
49
49
 
50
- Note: This does not include Pandas support. If you would like to use key features such as `to_pandas()` and `write_file()` you will need to install `pandas` separately.
50
+ Note: This does not include Pandas support. If you would like to use key features such as `to_pandas()` and `write_file()`, or to use PyArrow data conversion methods with nanosecond timestamp precision, you will need to install `pandas` separately.
51
51
 
52
52
  *Note: Please make sure you are using 3.9 or above. For the best performance use 3.11+*
53
53
 
54
+ ## CLI (Agent-Friendly Query Tool)
55
+
56
+ This package includes an `influx3` CLI for read/query workflows.
57
+
58
+ ### Run a query
59
+
60
+ ```bash
61
+ influx3 query -d my_database "SELECT * FROM cpu LIMIT 5"
62
+ ```
63
+
64
+ By default, output is JSON to stdout.
65
+
66
+ ### Supported formats
67
+
68
+ - `json` (default)
69
+ - `jsonl`
70
+ - `csv`
71
+ - `pretty`
72
+
73
+ ```bash
74
+ influx3 query -d my_database --format csv "SELECT * FROM cpu LIMIT 5"
75
+ ```
76
+
77
+ ### Config precedence
78
+
79
+ Configuration values are resolved in this order:
80
+
81
+ 1. CLI flags
82
+ 2. `INFLUXDB3_*` environment variables
83
+ 3. legacy `INFLUX_*` environment variables
84
+ 4. built-in defaults (host defaults to `http://127.0.0.1:8181`)
85
+
86
+ Relevant environment variables:
87
+
88
+ - `INFLUXDB3_HOST_URL` (legacy fallback: `INFLUX_HOST`)
89
+ - `INFLUXDB3_DATABASE_NAME` (legacy fallback: `INFLUX_DATABASE`)
90
+ - `INFLUXDB3_AUTH_TOKEN` (legacy fallback: `INFLUX_TOKEN`)
91
+
54
92
  # Usage
55
- One of the easiest ways to get started is to checkout the ["Pokemon Trainer Cookbook"](https://github.com/InfluxCommunity/influxdb3-python/blob/main/Examples/pokemon-trainer/cookbook.ipynb). This scenario takes you through the basics of both the client library and Pyarrow.
93
+ One of the easiest ways to get started is to check out the ["Influxdb3 Python Basic Usage"](https://github.com/InfluxCommunity/influxdb3-python/blob/main/examples/jupyter/basic-write-query.ipynb) notebook. This scenario takes you through the core write and read APIs of the client library.
94
+
95
+ Additional examples independent of jupyter are detailed in the [`./examples`](./examples/README.md) directory.
56
96
 
57
97
  ## Importing the Module
58
98
  ```python
@@ -203,6 +243,56 @@ client.write_dataframe(
203
243
  )
204
244
  ```
205
245
 
246
+ ### Accept partial writes and inspect failed lines
247
+ `accept_partial` defaults to `True` and allows partial success when writing through the V3 API endpoint (`use_v2_api=False`) and a batch contains invalid lines.
248
+ On partial failure, the client raises `InfluxDBPartialWriteError` with structured `line_errors`.
249
+
250
+ ```python
251
+ from influxdb_client_3 import InfluxDBClient3
252
+ from influxdb_client_3.exceptions import InfluxDBPartialWriteError
253
+
254
+ client = InfluxDBClient3(
255
+ host="http://localhost:8181",
256
+ token="token",
257
+ database="db",
258
+ write_use_v2_api=False,
259
+ )
260
+ lp = "home,room=Sunroom temp=96 1735545600\nhome,room=Sunroom temp=\"hi\" 1735549200"
261
+
262
+ try:
263
+ client.write(lp) # accept_partial=True by default on V3 API endpoint
264
+ except InfluxDBPartialWriteError as e:
265
+ for line_err in e.line_errors:
266
+ print(f"line {line_err.line_number} failed: {line_err.error_message} ({line_err.original_line})")
267
+ ```
268
+
269
+ Disable partial writes:
270
+ ```python
271
+ client = InfluxDBClient3(
272
+ host="http://localhost:8181",
273
+ token="token",
274
+ database="db",
275
+ write_use_v2_api=False,
276
+ write_accept_partial=False,
277
+ )
278
+ ```
279
+
280
+ ### Compatibility with InfluxDB Clustered and InfluxDB Cloud Dedicated/Serverless
281
+ Writes use the V2 API endpoint by default, so no additional configuration is required for these products.
282
+
283
+ `use_v2_api` can be configured by:
284
+ - `WriteOptions(use_v2_api=False)` (for V3 API endpoint features)
285
+ - constructor kwarg: `write_use_v2_api=False`
286
+ - env var: `INFLUX_WRITE_USE_V2_API=false`
287
+
288
+ When `use_v2_api=True`:
289
+ - `accept_partial` is not used
290
+ - `no_sync=True` is invalid and rejected before dispatch with:
291
+ `invalid write options: no_sync cannot be used with use_v2_api`
292
+
293
+ To use `no_sync` or `accept_partial` controls, set `use_v2_api=False`
294
+ (for example with InfluxDB 3 Core/Enterprise).
295
+
206
296
  ## Querying
207
297
 
208
298
  ### Querying with SQL
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: influxdb3-python
3
- Version: 0.19.0
3
+ Version: 0.20.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
@@ -96,12 +96,52 @@ You can install 'influxdb3-python' using `pip`:
96
96
  pip install influxdb3-python
97
97
  ```
98
98
 
99
- Note: This does not include Pandas support. If you would like to use key features such as `to_pandas()` and `write_file()` you will need to install `pandas` separately.
99
+ Note: This does not include Pandas support. If you would like to use key features such as `to_pandas()` and `write_file()`, or to use PyArrow data conversion methods with nanosecond timestamp precision, you will need to install `pandas` separately.
100
100
 
101
101
  *Note: Please make sure you are using 3.9 or above. For the best performance use 3.11+*
102
102
 
103
+ ## CLI (Agent-Friendly Query Tool)
104
+
105
+ This package includes an `influx3` CLI for read/query workflows.
106
+
107
+ ### Run a query
108
+
109
+ ```bash
110
+ influx3 query -d my_database "SELECT * FROM cpu LIMIT 5"
111
+ ```
112
+
113
+ By default, output is JSON to stdout.
114
+
115
+ ### Supported formats
116
+
117
+ - `json` (default)
118
+ - `jsonl`
119
+ - `csv`
120
+ - `pretty`
121
+
122
+ ```bash
123
+ influx3 query -d my_database --format csv "SELECT * FROM cpu LIMIT 5"
124
+ ```
125
+
126
+ ### Config precedence
127
+
128
+ Configuration values are resolved in this order:
129
+
130
+ 1. CLI flags
131
+ 2. `INFLUXDB3_*` environment variables
132
+ 3. legacy `INFLUX_*` environment variables
133
+ 4. built-in defaults (host defaults to `http://127.0.0.1:8181`)
134
+
135
+ Relevant environment variables:
136
+
137
+ - `INFLUXDB3_HOST_URL` (legacy fallback: `INFLUX_HOST`)
138
+ - `INFLUXDB3_DATABASE_NAME` (legacy fallback: `INFLUX_DATABASE`)
139
+ - `INFLUXDB3_AUTH_TOKEN` (legacy fallback: `INFLUX_TOKEN`)
140
+
103
141
  # Usage
104
- One of the easiest ways to get started is to checkout the ["Pokemon Trainer Cookbook"](https://github.com/InfluxCommunity/influxdb3-python/blob/main/Examples/pokemon-trainer/cookbook.ipynb). This scenario takes you through the basics of both the client library and Pyarrow.
142
+ One of the easiest ways to get started is to check out the ["Influxdb3 Python Basic Usage"](https://github.com/InfluxCommunity/influxdb3-python/blob/main/examples/jupyter/basic-write-query.ipynb) notebook. This scenario takes you through the core write and read APIs of the client library.
143
+
144
+ Additional examples independent of jupyter are detailed in the [`./examples`](./examples/README.md) directory.
105
145
 
106
146
  ## Importing the Module
107
147
  ```python
@@ -252,6 +292,56 @@ client.write_dataframe(
252
292
  )
253
293
  ```
254
294
 
295
+ ### Accept partial writes and inspect failed lines
296
+ `accept_partial` defaults to `True` and allows partial success when writing through the V3 API endpoint (`use_v2_api=False`) and a batch contains invalid lines.
297
+ On partial failure, the client raises `InfluxDBPartialWriteError` with structured `line_errors`.
298
+
299
+ ```python
300
+ from influxdb_client_3 import InfluxDBClient3
301
+ from influxdb_client_3.exceptions import InfluxDBPartialWriteError
302
+
303
+ client = InfluxDBClient3(
304
+ host="http://localhost:8181",
305
+ token="token",
306
+ database="db",
307
+ write_use_v2_api=False,
308
+ )
309
+ lp = "home,room=Sunroom temp=96 1735545600\nhome,room=Sunroom temp=\"hi\" 1735549200"
310
+
311
+ try:
312
+ client.write(lp) # accept_partial=True by default on V3 API endpoint
313
+ except InfluxDBPartialWriteError as e:
314
+ for line_err in e.line_errors:
315
+ print(f"line {line_err.line_number} failed: {line_err.error_message} ({line_err.original_line})")
316
+ ```
317
+
318
+ Disable partial writes:
319
+ ```python
320
+ client = InfluxDBClient3(
321
+ host="http://localhost:8181",
322
+ token="token",
323
+ database="db",
324
+ write_use_v2_api=False,
325
+ write_accept_partial=False,
326
+ )
327
+ ```
328
+
329
+ ### Compatibility with InfluxDB Clustered and InfluxDB Cloud Dedicated/Serverless
330
+ Writes use the V2 API endpoint by default, so no additional configuration is required for these products.
331
+
332
+ `use_v2_api` can be configured by:
333
+ - `WriteOptions(use_v2_api=False)` (for V3 API endpoint features)
334
+ - constructor kwarg: `write_use_v2_api=False`
335
+ - env var: `INFLUX_WRITE_USE_V2_API=false`
336
+
337
+ When `use_v2_api=True`:
338
+ - `accept_partial` is not used
339
+ - `no_sync=True` is invalid and rejected before dispatch with:
340
+ `invalid write options: no_sync cannot be used with use_v2_api`
341
+
342
+ To use `no_sync` or `accept_partial` controls, set `use_v2_api=False`
343
+ (for example with InfluxDB 3 Core/Enterprise).
344
+
255
345
  ## Querying
256
346
 
257
347
  ### Querying with SQL
@@ -2,26 +2,15 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  setup.py
5
- Examples/__init__.py
6
- Examples/basic_ssl_example.py
7
- Examples/batching_example.py
8
- Examples/cloud_dedicated_query.py
9
- Examples/cloud_dedicated_write.py
10
- Examples/config.py
11
- Examples/flight_options_example.py
12
- Examples/handle_http_error.py
13
- Examples/handle_query_error.py
14
- Examples/pandas_write.py
15
- Examples/query_async.py
16
- Examples/query_type.py
17
- Examples/query_with_middleware.py
18
- Examples/timeouts.py
19
5
  influxdb3_python.egg-info/PKG-INFO
20
6
  influxdb3_python.egg-info/SOURCES.txt
21
7
  influxdb3_python.egg-info/dependency_links.txt
8
+ influxdb3_python.egg-info/entry_points.txt
22
9
  influxdb3_python.egg-info/requires.txt
23
10
  influxdb3_python.egg-info/top_level.txt
24
11
  influxdb_client_3/__init__.py
12
+ influxdb_client_3/__main__.py
13
+ influxdb_client_3/cli.py
25
14
  influxdb_client_3/py.typed
26
15
  influxdb_client_3/read_file.py
27
16
  influxdb_client_3/version.py
@@ -33,6 +22,7 @@ influxdb_client_3/write_client/__init__.py
33
22
  influxdb_client_3/write_client/configuration.py
34
23
  influxdb_client_3/write_client/extras.py
35
24
  influxdb_client_3/write_client/rest.py
25
+ influxdb_client_3/write_client/write_defaults.py
36
26
  influxdb_client_3/write_client/_sync/__init__.py
37
27
  influxdb_client_3/write_client/_sync/api_client.py
38
28
  influxdb_client_3/write_client/_sync/rest.py
@@ -57,10 +47,9 @@ influxdb_client_3/write_client/domain/write_precision.py
57
47
  influxdb_client_3/write_client/domain/write_precision_converter.py
58
48
  influxdb_client_3/write_client/service/__init__.py
59
49
  influxdb_client_3/write_client/service/_base_service.py
60
- influxdb_client_3/write_client/service/signin_service.py
61
- influxdb_client_3/write_client/service/signout_service.py
62
50
  influxdb_client_3/write_client/service/write_service.py
63
51
  tests/test_api_client.py
52
+ tests/test_cli.py
64
53
  tests/test_dataframe_serializer.py
65
54
  tests/test_date_helper.py
66
55
  tests/test_deep_merge.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ influx3 = influxdb_client_3.cli:main
@@ -29,6 +29,8 @@ INFLUX_PRECISION = "INFLUX_PRECISION"
29
29
  INFLUX_AUTH_SCHEME = "INFLUX_AUTH_SCHEME"
30
30
  INFLUX_GZIP_THRESHOLD = "INFLUX_GZIP_THRESHOLD"
31
31
  INFLUX_WRITE_NO_SYNC = "INFLUX_WRITE_NO_SYNC"
32
+ INFLUX_WRITE_ACCEPT_PARTIAL = "INFLUX_WRITE_ACCEPT_PARTIAL"
33
+ INFLUX_WRITE_USE_V2_API = "INFLUX_WRITE_USE_V2_API"
32
34
  INFLUX_WRITE_TIMEOUT = "INFLUX_WRITE_TIMEOUT"
33
35
  INFLUX_QUERY_TIMEOUT = "INFLUX_QUERY_TIMEOUT"
34
36
  INFLUX_DISABLE_GRPC_COMPRESSION = "INFLUX_DISABLE_GRPC_COMPRESSION"
@@ -155,19 +157,19 @@ def _parse_gzip_threshold(threshold: str) -> int:
155
157
  return threshold
156
158
 
157
159
 
158
- def _parse_write_no_sync(write_no_sync: str):
160
+ def _parse_write_bool(value):
159
161
  """
160
- Parses and validates the provided write no sync value.
162
+ Parses a truthy/falsy value for write options.
161
163
 
162
- This function ensures that the given value is a valid boolean,
163
- and it raises an appropriate error if the value is not valid.
164
+ The input is normalized to string and matched against common truthy values.
165
+ Any non-truthy value is treated as False.
164
166
 
165
- :param write_no_sync: The input value to be parsed and validated.
166
- :type write_no_sync: Any
167
- :return: The validated write no sync value as an boolean.
167
+ :param value: The input value to be parsed and validated.
168
+ :type value: Any
169
+ :return: Parsed boolean value.
168
170
  :rtype: bool
169
171
  """
170
- return write_no_sync.strip().lower() in ['true', '1', 't', 'y', 'yes']
172
+ return str(value).strip().lower() in ['true', '1', 't', 'y', 'yes']
171
173
 
172
174
 
173
175
  def _parse_timeout(to: str) -> int:
@@ -226,13 +228,11 @@ class InfluxDBClient3:
226
228
  Defaults to "multiprocessing.cpu_count() * 5".
227
229
  :key urllib3.util.retry.Retry retries: Set the default retry strategy that is used for all HTTP requests
228
230
  except batching writes. As a default there is no one retry strategy.
229
- :key bool auth_basic: Set this to true to enable basic authentication when talking to a InfluxDB 1.8.x that
230
- does not use auth-enabled but is protected by a reverse proxy with basic authentication.
231
- (defaults to false, don't set to true when talking to InfluxDB 2)
232
- :key str username: ``username`` to authenticate via username and password credentials to the InfluxDB 2.x
233
- :key str password: ``password`` to authenticate via username and password credentials to the InfluxDB 2.x
234
231
  :key str query_timeout: int value used to set the client query API timeout in milliseconds.
235
232
  :key str write_timeout: int value used to set the client write API timeout in milliseconds.
233
+ :key bool write_accept_partial: allow partial writes when some lines fail.
234
+ :key bool write_use_v2_api: route writes through /api/v2/write compatibility endpoint.
235
+ :key bool write_no_sync: disable sync confirmation on V3 API endpoint writes.
236
236
  :key list[str] profilers: list of enabled Flux profilers
237
237
  """
238
238
  self._org = org if org is not None else "default"
@@ -243,6 +243,8 @@ class InfluxDBClient3:
243
243
  write_type = DefaultWriteOptions.write_type.value
244
244
  write_precision = DefaultWriteOptions.write_precision.value
245
245
  write_no_sync = DefaultWriteOptions.no_sync.value
246
+ write_accept_partial = DefaultWriteOptions.accept_partial.value
247
+ write_use_v2_api = DefaultWriteOptions.use_v2_api.value
246
248
  write_timeout = DefaultWriteOptions.timeout.value
247
249
 
248
250
  if isinstance(write_client_options, dict) and write_client_options.get('write_options') is not None:
@@ -250,15 +252,28 @@ class InfluxDBClient3:
250
252
  write_type = getattr(write_opts, 'write_type', write_type)
251
253
  write_precision = getattr(write_opts, 'write_precision', write_precision)
252
254
  write_no_sync = getattr(write_opts, 'no_sync', write_no_sync)
255
+ write_accept_partial = getattr(write_opts, 'accept_partial', write_accept_partial)
256
+ write_use_v2_api = getattr(write_opts, 'use_v2_api', write_use_v2_api)
253
257
  write_timeout = getattr(write_opts, 'timeout', write_timeout)
254
258
 
255
259
  if kw_keys.__contains__('write_timeout'):
256
260
  write_timeout = kwargs.get('write_timeout')
257
261
 
262
+ if kw_keys.__contains__('write_accept_partial') and kwargs.get('write_accept_partial') is not None:
263
+ write_accept_partial = _parse_write_bool(kwargs.get('write_accept_partial'))
264
+
265
+ if kw_keys.__contains__('write_use_v2_api') and kwargs.get('write_use_v2_api') is not None:
266
+ write_use_v2_api = _parse_write_bool(kwargs.get('write_use_v2_api'))
267
+
268
+ if kw_keys.__contains__('write_no_sync') and kwargs.get('write_no_sync') is not None:
269
+ write_no_sync = _parse_write_bool(kwargs.get('write_no_sync'))
270
+
258
271
  write_options = WriteOptions(
259
272
  write_type=write_type,
260
273
  write_precision=write_precision,
261
274
  no_sync=write_no_sync,
275
+ accept_partial=write_accept_partial,
276
+ use_v2_api=write_use_v2_api,
262
277
  )
263
278
 
264
279
  self._write_client_options = {
@@ -347,7 +362,15 @@ class InfluxDBClient3:
347
362
 
348
363
  write_no_sync = os.getenv(INFLUX_WRITE_NO_SYNC)
349
364
  if write_no_sync is not None:
350
- write_options.no_sync = _parse_write_no_sync(write_no_sync)
365
+ write_options.no_sync = _parse_write_bool(write_no_sync)
366
+
367
+ write_accept_partial = os.getenv(INFLUX_WRITE_ACCEPT_PARTIAL)
368
+ if write_accept_partial is not None:
369
+ write_options.accept_partial = _parse_write_bool(write_accept_partial)
370
+
371
+ write_use_v2_api = os.getenv(INFLUX_WRITE_USE_V2_API)
372
+ if write_use_v2_api is not None:
373
+ write_options.use_v2_api = _parse_write_bool(write_use_v2_api)
351
374
 
352
375
  precision = os.getenv(INFLUX_PRECISION)
353
376
  if precision is not None:
@@ -388,6 +411,11 @@ class InfluxDBClient3:
388
411
  """
389
412
  Write data to InfluxDB.
390
413
 
414
+ Warning: When you write with only one Point or one Dict, and If that Point or Dict
415
+ contains fields with None value, those fields will not be written to InfluxDB.
416
+ If such fields are later queried explicitly, for example,
417
+ "SELECT field_with_value, field_with_null_value FROM my_table" an error will be thrown.
418
+
391
419
  :param record: The data point(s) to write.
392
420
  :type record: object or list of objects
393
421
  :param database: The database to write to. If not provided, uses the database provided during initialization.
@@ -397,10 +425,7 @@ class InfluxDBClient3:
397
425
  if database is None:
398
426
  database = self._database
399
427
 
400
- try:
401
- return self._write_api.write(bucket=database, record=record, **kwargs)
402
- except InfluxDBError as e:
403
- raise e
428
+ return self._write_api.write(bucket=database, record=record, **kwargs)
404
429
 
405
430
  def write_dataframe(
406
431
  self,
@@ -0,0 +1,5 @@
1
+ from influxdb_client_3.cli import main
2
+
3
+
4
+ if __name__ == "__main__":
5
+ raise SystemExit(main())