I think this is an interesting idea worth exploring. I definitely agree with Benjamin who raised important questions which needs to be answered first. Also, what about triggers?
It might be rather "easy" to come up with something simple but it should be a comprehensive solution with predictable behavior we all agree on. If a keyspace of a new table does not exist we would need to create that one too before. For the simplicity, I would just make it a must to create it on same keyspace. We might iterate on that in the future. UDTs are created per keyspace so there is nothing to re-create. We just need to reference it from a new table, right? Indexes and MVs are interesting but in theory they might be re-created too. Would it be appropriate to use something like this? CREATE TABLE ks.tb_copy LIKE ks.tb WITH INDEXES AND VIEWS AND TRIGGERS .... Without "WITH" it would just copy a table with nothing else. On Mon, Aug 19, 2024 at 6:10 PM guo Maxwell <cclive1...@gmail.com> wrote: > Hello, everyone: > As Jira CASSANDRA-7662 > <https://issues.apache.org/jira/browse/CASSANDRA-7662> has described , we > would like to introduce a new grammer " CREATE TABLE LIKE " > ,which simplifies creating new tables duplicating the existing ones . > The format may be like : CREATE TABLE <new_table> LIKE <old_table> > > Before I implement this function, do you have any suggestions on this? > > Looking forward to your reply! >