Difficulty Importing CSV Data into InfluxDB

ha_debian
Sat, 17 Aug 2024 11:50:39 +0000
InfluxDB 2

Hi everyone,

I’m experiencing challenges while trying to import CSV data into InfluxDB, and I hope to get some guidance or insights from the community.

Here’s the Background:

I have a dataset that I’m trying to import into InfluxDB using the influx write command. My CSV data is intended to include measurements from sensors, specifically for a Power Usage Measurement application. However, I keep running into errors during the import process.

Example CSV Structure:

Initially, the CSV structure I tried was formatted like this:

plaintext

#datatype measurement,tag,tag,double,dateTime:RFC3339
kWh,domain,entity_id,value,time
sensor,l1_raw_kwh,66666,2024-08-17T03:15:00Z

Error Encountered:

Despite structuring my CSV to reflect what I believed was correct, I received errors related to parsing and handling timestamps. The specific error I faced was:

text

Error: failed to write data: 400 Bad Request: unable to parse 'sensor,domain=sensor,entity_id=l1_raw_kwh value=66666 1723864500000000000': time outside range -9223372036854775806 - 9223372036854775806

This indicated an issue with the timestamp, suggesting it wasn’t being interpreted correctly by InfluxDB.

Attempts to Resolve:

1. Confirmed the Correct Timestamp Format: Ensured that the timestamps were in RFC3339 format.

2. Checked Header Consistency: Verified that the #datatype line in the CSV header matched the data that followed.

3. Incrementally Simplified Data: Attempted to write smaller datasets to see if that resolved the parsing issue.

4. Used the Dry Run Command: Tried running the import with a dry run to see if it would process correctly without committing changes.

Despite these efforts, I continued to face the same issues, leading to significant frustration as I was unable to import the data as intended.

Request for Assistance:

I’m reaching out to seek advice or best practices on structuring CSV imports into InfluxDB. If anyone has faced a similar problem or has insights into what I might be missing, I would greatly appreciate your help.

Thank you for your time!

5 posts - 2 participants