Skip to content

autoconvert time to unixepoch ?

Hello.

I'm here because of a limitation i see using the telegraf software that use this sqlite driver.

telegraf use this driver to push timeserie metrics data into a sqlite database.

When doing this, it push the timestamp column as time.Time. The problem is that this driver doesn't seems to know how to effectively handle this in an efficient format (sqlite doesn't support time type), so we do get raw string.

_time_format=sqlite permit to have a better string format but it's still an inefficient format.

A better solution will be permitting somehow to autoconvert time.Time as unixepoch time, it can be when column type is integer and/or with a specific dsn argument liketime_format . we may also do this with a "custom type", this have the benefit of clarity but the drawback of disabling the usage of "strict mode".

So i'm asking if something can be done in the driver side to solve this kind of issue. Thanks for your response.

The original discussion in the telegraf github : https://github.com/influxdata/telegraf/issues/17317

Edited by inkhey