-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fixed serialization of DataFrame with empty (NaN) values, fixed escaping whitespaces, fixed order of tags #123
Conversation
Codecov Report
@@ Coverage Diff @@
## master #123 +/- ##
==========================================
+ Coverage 88.71% 88.93% +0.21%
==========================================
Files 22 23 +1
Lines 1826 1852 +26
==========================================
+ Hits 1620 1647 +27
+ Misses 206 205 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also fix escaping of white spaces:
def test_tag_escaping_key_and_value(self):
from influxdb_client.extras import pd, np
now = pd.Timestamp('2020-04-05 00:00+00:00')
data_frame = pd.DataFrame(data=[["new\nline", "carriage\nreturn", "t\tab", np.int64(100.5)], ],
index=[now + timedelta(hours=1), ],
columns=["new\nline", "carriage\rreturn", "t\tab", "l\ne\rv\tel"])
points = data_frame_to_list_of_points(data_frame=data_frame,
point_settings=PointSettings(),
data_frame_measurement_name='h\n2\ro\t_data',
data_frame_tag_columns={"new\nline", "carriage\rreturn", "t\tab"})
self.assertEqual(1, len(points))
self.assertEqual("h\\n2\\ro\\t_data,carriage\\rreturn=carriage\\nreturn,new\\nline=new\\nline,t\\tab=t\\tab l\\ne\\rv\\tel=2i",
points[0])
Looks like the 3.7 check might just need to be rerun; it's a 500 error from the influx server. |
Hi @7yl4r, we want to also fix a problem with serialization of whitespaces and order of tags (https://v2.docs.influxdata.com/v2.0/write-data/best-practices/optimize-writes/#sort-tags-by-key) I hope that we are be able to merge it soon. Regards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also fix order of tags:
def test_tags_order(self):
from influxdb_client.extras import pd, np
now = pd.Timestamp('2020-04-05 00:00+00:00')
data_frame = pd.DataFrame(data=[["c", "a", "b", np.int64(2)], ],
index=[now + timedelta(hours=1), ],
columns=["c", "a", "b", "level"])
points = data_frame_to_list_of_points(data_frame=data_frame,
point_settings=PointSettings(),
data_frame_measurement_name='h2o',
data_frame_tag_columns={"c", "a", "b"})
self.assertEqual(1, len(points))
self.assertEqual("h2o,a=a,b=b,c=c level=2i 1586048400000000000", points[0])
https://v2.docs.influxdata.com/v2.0/write-data/best-practices/optimize-writes/#sort-tags-by-key
2ebf5a3
to
a014150
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #118
\n
,\r
and\t