How am I able to create and drop buckets in Tasks?

How am I able to create and drop buckets in Tasks?
also how am I able to drop measurements in Tasks?

1 Like

Hello @hamwong,
Welcome! Good question!
You can create bucket with the function in a Flux task:
But you can’t delete a bucket as there isn’t a del request function in Flux.
You can’t drop measurements. You can delete all the points in a measurement with the CLI:
The closest thing you can do is to create one task that moves data to a different measurement with the to() function in a NEW bucket (after using the set() function to change the measurement value) and then making sure that your old/oringinal bucket has a short retention period.

I found a work around way, I use bash with crontab, it make everything easier, in windows also can run with ps1 with task schedule, I really think v2 much harder than v1…
Thank you anyway

Hello @hamwong,
What do you think is harder about v2 than v1?

it is more powerful with flux especially you can do the regex but I found some of function have limited or deprecated, like create/drop buckets, drop measurement or series with regex (even cli can delete measurement, but Delete predicates do not support regular expressions.
I also feel confused to check with field keys, with v1, it simply with “show field keys from xxx”
but with v2, I can’t figure out what the v2 output meaning yet.

Hello @hamwong,
Thanks for your input. Your opinion is really valuable to me.

Have you seen the schema package?

Also you can run the 1.x API against 2.x with the forward compatibility endpoints:

Which supports the following InfluxQL queries:
Including “show field keys”