Skip to content

Commit e043b1e

Browse files
authored
Merge branch 'master' into retry_with_backoff
2 parents a66c555 + f8bba58 commit e043b1e

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

influxdb/_dataframe_client.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,6 @@ def _convert_dataframe_to_lines(self,
298298
field_columns = list(field_columns) if list(field_columns) else []
299299
tag_columns = list(tag_columns) if list(tag_columns) else []
300300

301-
# Make global_tags as tag_columns
302-
if global_tags:
303-
for tag in global_tags:
304-
dataframe[tag] = global_tags[tag]
305-
tag_columns.append(tag)
306-
307301
# If field columns but no tag columns, assume rest of columns are tags
308302
if field_columns and (not tag_columns):
309303
tag_columns = list(column_series[~column_series.isin(
@@ -333,6 +327,13 @@ def _convert_dataframe_to_lines(self,
333327

334328
# If tag columns exist, make an array of formatted tag keys and values
335329
if tag_columns:
330+
331+
# Make global_tags as tag_columns
332+
if global_tags:
333+
for tag in global_tags:
334+
dataframe[tag] = global_tags[tag]
335+
tag_columns.append(tag)
336+
336337
tag_df = dataframe[tag_columns]
337338
tag_df = tag_df.fillna('') # replace NA with empty string
338339
tag_df = tag_df.sort_index(axis=1)
@@ -345,6 +346,12 @@ def _convert_dataframe_to_lines(self,
345346
tags = tags.sum(axis=1)
346347

347348
del tag_df
349+
elif global_tags:
350+
tag_string = ''.join(
351+
[",{}={}".format(k, _escape_tag(v)) if v else ''
352+
for k, v in sorted(global_tags.items())]
353+
)
354+
tags = pd.Series(tag_string, index=dataframe.index)
348355
else:
349356
tags = ''
350357

influxdb/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __init__(self,
115115
self._port)
116116

117117
self._headers = {
118-
'Content-type': 'application/json',
118+
'Content-Type': 'application/json',
119119
'Accept': 'text/plain'
120120
}
121121

@@ -293,7 +293,7 @@ def write(self, data, params=None, expected_response_code=204,
293293
:rtype: bool
294294
"""
295295
headers = self._headers
296-
headers['Content-type'] = 'application/octet-stream'
296+
headers['Content-Type'] = 'application/octet-stream'
297297

298298
if params:
299299
precision = params.get('precision')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy