Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
==========================================
+ Coverage 70.89% 75.12% +4.22%
==========================================
Files 35 35
Lines 2388 2420 +32
==========================================
+ Hits 1693 1818 +125
+ Misses 695 602 -93 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a tag_order write option to control tag serialization order in line protocol so users can influence first-write column order (notably for InfluxDB 3 Enterprise schema/query performance considerations).
Changes:
- Introduces
tag_orderonWriteOptionsand threads it through write paths toPoint.to_line_protocol(...). - Updates
Pointtag serialization to honor a caller-specified tag priority order. - Adds/updates tests and documentation (README + CHANGELOG) for the new option.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_point.py | Adds coverage for tag ordering behavior in Point.to_line_protocol(tag_order=...). |
| tests/test_influxdb_client_3.py | Verifies WriteOptions.tag_order sanitization/defaults and exercises dict batching path. |
| influxdb_client_3/write_client/domain/write_precision.py | Marks common model helpers as # pragma: no cover. |
| influxdb_client_3/write_client/client/write_api.py | Adds tag_order to WriteOptions, sanitizes it, and plumbs it into serialization while filtering it from HTTP kwargs. |
| influxdb_client_3/write_client/client/write/point.py | Implements ordered tag key selection based on tag_order before falling back to sorted remaining tags. |
| influxdb_client_3/write_client/client/_base.py | Passes tag_order through _serialize() when serializing Point records. |
| README.md | Documents how to configure tag_order via WriteOptions. |
| CHANGELOG.md | Adds a feature entry for tag_order. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
influxdb_client_3/write_client/client/write/polars_dataframe_serializer.py:104
self.tag_columnsis used with+ [self.timestamp_column]inside the fields comprehension, which will raiseTypeErrorif callers pass a non-list iterable (e.g.,set/tuple) fordata_frame_tag_columns. Consider normalizingdata_frame_tag_columnsto a list in__init__(or precomputing asetof excluded columns) and using membership checks against that set to avoid both type issues and repeated list allocations per column.
fields = ",".join(
f"{col}=\"{self.escape_value(row[self.column_indices[col]])}\"" if isinstance(row[self.column_indices[col]],
str)
else f"{col}={str(row[self.column_indices[col]]).lower()}" if isinstance(row[self.column_indices[col]],
bool) # Check for bool first
else f"{col}={row[self.column_indices[col]]}i" if isinstance(row[self.column_indices[col]], int)
else f"{col}={row[self.column_indices[col]]}"
for col in self.column_indices
if col not in self.tag_columns + [self.timestamp_column] and
row[self.column_indices[col]] is not None and row[self.column_indices[col]] != ""
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed Changes
Adds support for specifying column (tag) order during ingestion via the new
tag_orderwrite option. This is primarily intended for the initial write, where sorting tags by query priority can significantly impact query performance:https://docs.influxdata.com/influxdb3/enterprise/write-data/best-practices/schema-design/#sort-tags-by-query-priority
Checklist