I would like to post data from a CSV file to InfluxDB file and the Time column of InfluxDB should match with CSV file Time column. I meant InfluxDB time series should same as CSV file’s Time series.
My main motive is InfluxDB should store the data of CSV file with respect CSV file’s time series.
The CSV file like is shown below
Time Energy Power
12-26-2017 7:34:27 103691 24.838
12-26-2017 7:35:28 103693 19.525
I have used this spice code to convert CSV file’s time to epoch to send the InfluxDB server.
t = "2017-12-26 07:34:27"
lctime = (int(time.mktime(time.strptime(t,"%Y-%m-%d %H:%M:%S")))) * 1000000000 #in nano second`
and I have posted this data to InfluxDB server in JSON format.
client.write_points([
{"measurement": "Meter1",
"tags":{"host": "localPC",
"Region": "Northam"},
"Time":lctime,
"fields":{"Energy": e1,
"Power": p1,
}
}
]
There was no issue with posting these data to InfluxDB server but when I went to check whether the correct data was written or not into Influxdb using this query in database panel.
Select * From Meter1
The influxDB showed me this "2018-01-04T05:43:41.580065574Z" time but it should have shown me “2017-12-26 07:34:27” as same as CSV file’s time.
Please tell me in which method I can match the time of CSV and InfluxDB?
Please tell me in which method I can do this thing which I want?