How to list bucket-schema with Influx 2.7.4

Hi, I’m running Influx 2.7.4 alpine docker container. I have installed influx command line tool on my Ubuntu VM. I’m trying to list the schema for my bucket but I’m getting this error:

Error: InfluxDB Cloud-only command used with InfluxDB OSS host

This is the command that I’m running:
influx bucket-schema list --bucket "st-lab"

From the error message it seems like its not possible to run this command with I guess the version of InfluxDB that I’m using. Is this correct or is there a different way for me to list the schema of my bucket?

@mohsin106 As noted in the documentation, the bucket-schema feature is only available in InfluxDB Cloud (TSM and Serverless). This feature actually lets you define explicit data schemas for buckets and reject points written to the bucket that don’t match the defined schema.

With InfluxDB OSS 2.7, you can query schema information using the query API and Flux. If you want to stick with the influx CLI, you can use the influx query command. There isn’t a simple query that returns the entire schema of a bucket, but you can get schema information with queries documented in Explore your schema with Flux. For example:

# Return a list of measurements
influx query '
  import "influxdata/influxdb/schema"

  schema.measurements(bucket: "example-bucket")
'
1 Like

Thanks for pointing me in the right direction. I noticed that the field name is limited to a certain amount of characters. Is there any parameter I can set that would show the whole field name?

influx query '
  import "influxdata/influxdb/schema"

  schema.measurementFieldKeys(bucket: "st-lab", measurement: "qmon")
'
Result: _result
Table: keys: []
         _value:string
----------------------
                 bytes
               packets
        parent-ae-name
peak-buffer-occupan...     // full field name is peak-buffer-occupancy-bytes
peak-buffer-occupan...    // full field name is peak-buffer-occupancy-percent
       tail-drop-bytes
     tail-drop-packets

Not that I know of. This is just a limitation of the console table visualization. You can use the -r or --raw flag to just output straight annotated CSV. That won’t include any truncated field keys.

influx query '
  import "influxdata/influxdb/schema"

  schema.measurementFieldKeys(bucket: "st-lab", measurement: "qmon")
' --raw