Is there a way to move a table to a different database?

11 views
Skip to first unread message

Michal Singer

unread,
Jun 9, 2020, 2:48:53 AM6/9/20
to ClickHouse
Hi, I create a table under default database and now i want to move it to a different database.
Is there a way to do this?

Thanks

Muli Golan

unread,
Jun 9, 2020, 2:52:00 AM6/9/20
to ClickHouse
1. Create the table in the database you would like it to be in.
2. detach all partitions from old table
3. move the files of the detached partitions to the folder detached under the new table name
4. attach the partitions

Michal Singer

unread,
Jun 9, 2020, 3:43:47 AM6/9/20
to ClickHouse
Thanks, is there a simpler way to do this?

Denis Zhuravlev

unread,
Jun 9, 2020, 6:34:43 AM6/9/20
to ClickHouse
Rename table old_db.t to new_db.t
Reply all
Reply to author
Forward
0 new messages