Panic column:string is not type of time

I am trying to read data from an sql server using sql.from() and write it back to influxdb 2.0 using to().

query = "SELECT create_datetime FROM table"

Yet I get a strange error:

Error: panic: column create_datetime:string is not of type time

I didn’t even get to the to() part. Why does it care about the data type? String or not give me whatever you read. Also, create_datetime is a timestamp column in postgresql.

I’ve been searching through docs but these pages didn’t help much.

CAST(create_datetime AS timestamp) solved the problem.

1 Like

@Mert thanks for sharing your solution and marking it!