s***@oztron.net
2018-01-08 04:42:34 UTC
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,
}
}
]
Enter code here...
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 been shown me "2017-12-26 07:34:27" as same as CSV file's time.
Please tell me in which method I can math the time of CSV and InfluxDB?
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,
}
}
]
Enter code here...
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 been shown me "2017-12-26 07:34:27" as same as CSV file's time.
Please tell me in which method I can math the time of CSV and InfluxDB?
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/991ac55a-3bb9-4205-a3f1-e8a7b1bce52d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/991ac55a-3bb9-4205-a3f1-e8a7b1bce52d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.