Hi, I am trying to use a flux query to aggregate some data, and I need to use an import for the types package. I think the error may be in my syntax, but cannot get it to import anything no matter what package I choose.
My query is this:
option task = {name: "downsample2yHAData", every: 5m}
import "types"
// Handle numeric data
numericData = from(bucket: "homeassistant")
|> range(start: -duration(v: "5m"))
|> filter(fn: (r) => type(v: r._value) == "float" or type(v: r._value) == "int")
|> aggregateWindow(every: 5m, fn: mean)
// Handle string data
stringData = from(bucket: "homeassistant")
|> range(start: -duration(v: "5m"))
|> filter(fn: (r) => type(v: r._value) == "string")
|> last()
// Write data to the new bucket
union(tables: [numericData, stringData])
|> to(bucket: "ha_2y_5m")`
The error I get is:
Error: 400 Bad Request: invalid options: loc 3:1-3:7: invalid statement @3:1-3:7: import
Could someone help me determine what I am doing incorrectly, or which documentation I should be looking through? The OSS 2.7 docs describe using import in flux as standard, unless I am missing something (also not unlikely)
Thanks folks