influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
29.02k stars 3.56k forks source link

Cant import influxdata/influxdb/schema #19889

Open bearish opened 4 years ago

bearish commented 4 years ago

Influx 1.8.3 docker installation

When trying to execute a schema function like https://docs.influxdata.com/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys/

Using curl curl -XPOST localhost:8086/api/v2/query -sS -H 'Accept:application/csv' -H 'Content-type:application/vnd.flux' -d 'import "influxdata/influxdb/schema" schema.measurementFieldKeys( bucket: "telegraf", measurement: "cpu", ) ' i get the following error

"type error 1:1-1:36: unknown import path: ""influxdata/influxdb/schema"""

sanderson commented 4 years ago

@bearish what version of InfluxDB are you using? The schema package just landed in Flux last week and may not be part of your build. What function(s) are you trying to use? The majority of the schema functions were just ported from the influxdata/influxdb/v1 package, which you should be able to use with your current version of InfluxDB.

bearish commented 4 years ago

@sanderson Influx 1.8.3

when using the influxdata/influxdb/v1 import, i get no error on the import statement but schema.measurementFieldKeys( bucket: "telegraf", measurement: "cpu", )

Fails with "type error 3:1-3:7: undefined identifier ""schema"""

Best regards

sanderson commented 4 years ago

You need to update import statement AND the function call to use the v1 package:

import "influxdata/influxdb/v1"

v1.measurementFieldKeys(
  bucket: "telegraf",
  measurement: "cpu",
)