From https://github.com/influxdb/influxdb/issues/828#issuecomment-83224779
e.g. RENAME MEASUREMENT foo TO bar
Would need to update all CQs for the new measurement name.
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+100
+1
+1
+1
+1
How is it going?
+1
+1
Is there any workaround so far? Like exporting use sed to rename and import again or something?
+1
Update: do not use this workaround - it converts tags into fields! See other comments for better ideas.
A workaround is:
SELECT * INTO new_name FROM old_name
DROP MEASUREMENT old_name
Although I had problems dropping the old name due to "in use" errors. Still, +1.
See http://docs.influxdata.com/influxdb/v0.12/query_language/data_exploration/#relocate-data
+1
+1
+1
+1
Comment on the mentioned workaround:
SELECT * INTO new_name FROM old_name
This converts all tags to fields, causing overwrites at points with identical timestamps, see http://docs.influxdata.com/influxdb/v1.2/troubleshooting/frequently-asked-questions/#why-are-my-into-queries-missing-data.
So one should use SELECT * INTO new_name FROM old_name GROUP BY *.
+1
SELECT * INTO new_name FROM old_name GROUP BY *
DROP MEASUREMENT old_name
Yes, it works
but there is unacceptable for a big data and bulk rename - so long time.
Still, +1.
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
I appreciate this feature too. Because downsampled measurements are renamed and it's impossible to use already created Grafana dashboards. You need to create new ones with modified measurement names in SELECT.
+1
+1
+1
+1
+1
If you're going to reply with ":+1:", please stop. Github already has this feature. Choose a comment above you agree with, and :+1: that one instead.
Or add something that hasn't been mentioned before, e.g. that SELECT INTO doesn't display any progress indicator, so estimating how long a "rename" would take is a shot in the dark.
UPDATE: do NOT run the workaround! It ended up corrupting my database.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
+100 need it right now though :)
Is this a planned feature, or do we have to go with the SELECT * INTO ... solution?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Unstale.
Another update on running the workaround: this time SELECT * INTO ... FROM ... did something that apparently converted tags to fields.
Again, be very careful when running the workaround. It's not a solid solution.
Hello,
Altering metadata is a major limitation of InfluxDB. Since InfluxQL does not support alter query types for measurements, tags or fields, I decided to implement a tool as a workaround.
The tool supports a RenameMeasurement rule to rename a measurement and update the fields index. It is an offline tool, so the node must be taken down first (the exact same way you would run influx_inspect buildtsi).
Please check it and let me know if it helps.
https://github.com/Abc-Arbitrage/infix
Any feedback is also welcome.
Most helpful comment
Yes, it works
but there is unacceptable for a big data and bulk rename - so long time.
Still, +1.