Cannot see fields, tags for a measurement after an import (schema.* methods not working)


I imported data on a new bucket using the following annotated CSV:

# datatype measurement,ignored,tag,tag,long,time,ignored
"school","Andover School District","Andover Elementary School","Andover",0,"2020-10-08T00:00:00Z","06/23/2021"
"school","Andover School District","Andover Elementary School","Andover",0,"2020-10-15T00:00:00Z","06/23/2021"
"school","Andover School District","Andover Elementary School","Andover",0,"2020-10-22T00:00:00Z","06/23/2021"
"school","Andover School District","Andover Elementary School","Andover",0,"2020-10-29T00:00:00Z","06/23/2021"

And the import goes well, no errors (below is an example of the dry-run command):

docker run --rm --tty --interactive --volume $HOME/Documents/InfluxDBIntro/data:/mnt:ro influxdb:latest influx write dryrun --org Kodegeek --format csv --bucket covid19 --file /mnt/COVID-19_Cases_in_CT_Schools_Annotated.csv
school,city=Andover,name=Andover\ Elementary\ School total=0i 1602115200000000000
school,city=Andover,name=Andover\ Elementary\ School total=0i 1602720000000000000
school,city=Andover,name=Andover\ Elementary\ School total=0i 1603324800000000000
school,city=Andover,name=Andover\ Elementary\ School total=0i 1603929600000000000

At the end I do expect to be able to see the following when asking for schema metadata:

  • datatype measurement = school
  • name=tag
  • city=tag
  • total=long value
  • time=timestamp

I can get what measurements are on my COVID19 bucket (returns school):

import "influxdata/influxdb/schema"
schema.measurements(bucket: "COVID19")

Yet the following queries come empty, no information about the tags or the values for the school measurement:

import "influxdata/influxdb/schema"
schema.measurementTagKeys(bucket: "COVID19", measurement: "school")

Nor values for the tag “name” for the measurement “school”:

import "influxdata/influxdb/schema"
schema.measurementTagValues(bucket: "COVID19", measurement: "school", tag: "name")

So, a more fundamental question, there is ANY data? The following query returns lots of data:

from(bucket: "COVID19")
  |> range(start: -3y)
  |> filter(fn: (r) => == "Greenwich")
  |> yield()

And I can see fields, tags and values, as expected!:

I’m using the following:

  • InfluxDB v2.4.0 (Docker container with an external volume)
  • Server: de247ba
  • Frontend: a2bd1f3

Can someone point out what is my mistake? I feel it is something that is pretty obvious.



Two more things I noticed:

  1. The following query works by giving me the number of cases per town but the results come unsorted:
from(bucket: "COVID19")
    |> range(start: -3y)
    |> filter(fn: (r) => r._measurement == "school" and r._field == "total")
    |> group(columns: ["city"])
    |> drop(columns: ["name", "_start", "_stop"])
    |> sum()
    |> sort(columns: ["_value", "city"], desc: true)
  1. If I try to construct the query using the QueryBuilder UI, it doesn’t work as it is unable to get tags, fields, etc.

schema.* functions has start parameter with default value -30d, so you just need to set it right to match the data just like you did in range() filter.

Hello @alespour,

You where right about the ranges for the query builder (you must specify the proper custom range to get it to work). Using the proper values fixes my problem there.

I’m using INFLUXDB_VERSION=2.4.0 and I checked the documentation (schema.tagValues() function | Flux 0.x Documentation) and I do see a ‘start’ argument, but for some reason it doesn’t work on the UI for the following:

  • schema.measurements
  • schema.measurementTagKeys
  • schema.measurementTagValues
import "influxdata/influxdb/schema"
schema.measurements(bucket: "COVID19", start: -3y)

So did a little bit more digging and then checked the FLUX version that comes with Influxdb 2.40: 0.179.0 but no hint if start is supported there.

Can you tell which version of Influxdb/ Flux are you using?

Thanks for looking into this.