Browse Source

corrected time format in query

tanja 3 years ago
parent
commit
87a4ab8f30
1 changed files with 8 additions and 0 deletions
  1. 8 0
      cdplib/db_handlers/InfluxdbHandler.py

+ 8 - 0
cdplib/db_handlers/InfluxdbHandler.py

@@ -12,6 +12,8 @@ import pandas as pd
 
 from influxdb import DataFrameClient
 
+from datetime import datetime
+
 
 class InfluxdbHandler:
     """
@@ -104,6 +106,12 @@ class InfluxdbHandler:
         :rtype: TYPE
 
         """
+        if not isinstance(start, str):
+            start = datetime.strftime(start, format="%Y-%m-%dT%H:%M:%SZ")
+
+        if not isinstance(stop, str):
+            start = datetime.strftime(stop, format="%Y-%m-%dT%H:%M:%SZ")
+
         query = 'SELECT ' +\
                 columns +\
                 ' FROM \"' +\