Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions influxdb_client/client/flux_csv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,16 @@ def _prepare_data_frame(self):

# We have to create temporary DataFrame because we want to preserve default column values
_temp_df = pd.DataFrame(self._data_frame_values)
# This is for backward compatibles reason
# In newer Pandas versions 'string' type will be 'str', in older versions 'string' type will be 'object'
# In newer Pandas versions 'time' will be 'datetime64[us, UTC]', in older versions 'time'
# will be 'datetime64[ns, UTC]'
for column in _temp_df.columns:
if _temp_df[column].dtype.name == 'str':
_temp_df[column] = _temp_df[column].astype(object)
if _temp_df[column].dtype.name == 'datetime64[us, UTC]':
_temp_df[column] = _temp_df[column].astype('datetime64[ns, UTC]')

self._data_frame_values = []

# Custom DataFrame index
Expand Down
3 changes: 2 additions & 1 deletion tests/test_WriteApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ def test_redirect(self):
Retry.DEFAULT.remove_headers_on_redirect = Retry.DEFAULT_REMOVE_HEADERS_ON_REDIRECT
self.influxdb_client.close()

self.influxdb_client = InfluxDBClient(url="http://localhost", token="my-token", org="my-org")
retries = Retry(redirect=1, remove_headers_on_redirect=[])
self.influxdb_client = InfluxDBClient(url="http://localhost", token="my-token", org="my-org", retries=retries)

httpretty.register_uri(httpretty.POST, uri="http://localhost2/api/v2/write", status=204)
httpretty.register_uri(httpretty.POST, uri="http://localhost/api/v2/write", status=301,
Expand Down
Loading