CrateDB needs tables to be dropped before a restore.
Options unavailable:
@SQL
Multiple statements copied into console/crash cli
Is there an easy way to do this?
The way I resolved this was via a bash script using the Crash CLI which pulls the tables and drops them individually.
You will need to set $HOST and $TABLE_CATALOG
crash --hosts $HOST -c "SELECT CONCAT('\"', TABLE_CATALOG, '\".\"', TABLE_NAME, '\"') FROM INFORMATION_SCHEMA.tables WHERE table_catalog = $TABLE_CATALOG --format="csv" |
tail -n +2 | head -n -1 | sed 's/"/\\"/g' |
xargs -I {} crash --hosts $HOST -c 'DROP TABLE {}'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.