|
27 | 27 | DEFAULT_WRITE_NO_SYNC = False |
28 | 28 | DEFAULT_WRITE_TIMEOUT = 10_000 |
29 | 29 |
|
| 30 | +# Kwargs consumed during serialization that should not be passed to _post_write |
| 31 | +SERIALIZER_KWARGS = { |
| 32 | + # DataFrame-specific kwargs |
| 33 | + 'data_frame_measurement_name', |
| 34 | + 'data_frame_tag_columns', |
| 35 | + 'data_frame_timestamp_column', |
| 36 | + 'data_frame_timestamp_timezone', |
| 37 | + # Record-specific kwargs (dict, NamedTuple, dataclass) |
| 38 | + 'record_measurement_key', |
| 39 | + 'record_measurement_name', |
| 40 | + 'record_time_key', |
| 41 | + 'record_tag_keys', |
| 42 | + 'record_field_keys', |
| 43 | +} |
| 44 | + |
30 | 45 | logger = logging.getLogger('influxdb_client_3.write_client.client.write_api') |
31 | 46 |
|
32 | 47 | if _HAS_DATACLASS: |
@@ -397,9 +412,12 @@ def write(self, bucket: str, org: str = None, |
397 | 412 |
|
398 | 413 | _async_req = True if self._write_options.write_type == WriteType.asynchronous else False |
399 | 414 |
|
| 415 | + # Filter out serializer-specific kwargs before passing to _post_write |
| 416 | + http_kwargs = {k: v for k, v in kwargs.items() if k not in SERIALIZER_KWARGS} |
| 417 | + |
400 | 418 | def write_payload(payload): |
401 | 419 | final_string = b'\n'.join(payload[1]) |
402 | | - return self._post_write(_async_req, bucket, org, final_string, payload[0], no_sync, **kwargs) |
| 420 | + return self._post_write(_async_req, bucket, org, final_string, payload[0], no_sync, **http_kwargs) |
403 | 421 |
|
404 | 422 | results = list(map(write_payload, payloads.items())) |
405 | 423 | if not _async_req: |
|
0 commit comments