Skip to content

test: add escape for keys when serialize#202

Merged
NguyenHoangSon96 merged 5 commits intomainfrom
fix/escape-string-polars
Mar 24, 2026
Merged

test: add escape for keys when serialize#202
NguyenHoangSon96 merged 5 commits intomainfrom
fix/escape-string-polars

Conversation

@NguyenHoangSon96
Copy link
Contributor

@NguyenHoangSon96 NguyenHoangSon96 commented Mar 24, 2026

Closes Issue

Proposed Changes

  • Add escape function for fields when serialized with polars.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@NguyenHoangSon96 NguyenHoangSon96 self-assigned this Mar 24, 2026
@NguyenHoangSon96 NguyenHoangSon96 added this to the 0.17.0 milestone Mar 24, 2026
@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.17%. Comparing base (42620f3) to head (cdfde4e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #202   +/-   ##
=======================================
  Coverage   75.17%   75.17%           
=======================================
  Files          35       35           
  Lines        2417     2417           
=======================================
  Hits         1817     1817           
  Misses        600      600           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses missing escaping of Polars DataFrame field names (keys) when serializing to InfluxDB line protocol, aligning Polars serialization behavior with line protocol requirements and closing the reported issue.

Changes:

  • Escape field keys (column names) during Polars DataFrame serialization to line protocol.
  • Add a regression test covering whitespace escaping in tag keys and field keys.
  • Update the changelog with the new behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
influxdb_client_3/write_client/client/write/polars_dataframe_serializer.py Escapes field keys via escape_key() when building the fields portion of line protocol.
tests/test_polars.py Adds a test asserting proper escaping for whitespace in tag keys and field keys.
CHANGELOG.md Documents the change in upcoming release notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@alespour alespour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Copilot suggests more precise wording in CHANGELOG, but I think it is nitpicking.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@NguyenHoangSon96 NguyenHoangSon96 merged commit 57e7d4c into main Mar 24, 2026
16 checks passed
@NguyenHoangSon96 NguyenHoangSon96 deleted the fix/escape-string-polars branch March 24, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

polars dataframe serializer missing field name escapes

3 participants