Replies: 4 comments 10 replies
-
If you use a different output format and just export the create_table_query column then the result is valid sql (and consumably by clickhouse). For example:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for trying, but I'm afraid that is too simple. I'm looking for a built-in way, just like |
Beta Was this translation helpful? Give feedback.
-
I've created the feature request at #60681. |
Beta Was this translation helpful? Give feedback.
-
Would love to have this be a native part of ClickHouse, but in the meantime I've written this small utility program if it's helpful to anyone: |
Beta Was this translation helpful? Give feedback.
-
Is there an equivalent to postgres
pg_dump --schema-only
?As described at https://www.postgresql.org/docs/current/app-pgdump.html,
--schema-only
, dumps all the database schema as SQL statements (e.g.create table
statements).I've tried using
clickhouse client --query 'select name, create_table_query from system.tables where database='uptrace' format Vertical;'
but that is a too verbose query and far from being something that could be put in a.sql
file and execute it to recreate the schema in a fresh database. And it seems to lack other database objects, like columns.Beta Was this translation helpful? Give feedback.
All reactions