Support backing up clickhouse to file

It's janky, but it works
This commit is contained in:
Jake Howard 2021-05-16 12:25:32 +01:00
parent b4936f5780
commit 5f6dc6e177
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -29,6 +29,16 @@ do
echo Backing up postgres $db_name
docker exec $container_id bash -c 'PGPASSWORD=$POSTGRES_PASSWORD pg_dumpall -U $POSTGRES_USER' | pv > $BACKUP_DIR/$db_name-$DATE.sql
;;
"yandex/clickhouse-server")
# Hardcode for plausible
tables=$(docker exec $container_id clickhouse-client --query "SELECT name FROM system.tables where database == 'plausible';")
for table in $tables
do
echo Backing up clickhouse table $table
docker exec $container_id clickhouse-client --query "SELECT * FROM plausible.$table" --format CSVWithNames | pv > $BACKUP_DIR/plausible-$table-$DATE.csv
done
;;
esac
done