Last active
March 14, 2024 16:11
-
-
Save redsquare/b7ff192ef0b89e52fd6414b350b7b963 to your computer and use it in GitHub Desktop.
Dump Clickhouse Table Schemas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#dump table ddl's | |
clickhouse-client --host your_clickhouse_host -q "SHOW TABLES FROM db_name" | while read -r table_name; do | |
clickhouse-client --host your_clickhouse_host -q "SHOW CREATE TABLE db_name.\`$table_name\`" >> db_structure.sql | |
done | |
#restore | |
clickhouse-client --host target_clickhouse_host < db_structure.sql | |
#also in /var/lib/clickhouse/metadata/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment