I have a table named table1 which includes the following
+----------+-------+
|date |count |
+----------+-------+
|2022-01-07|2 |
|2022-01-06|0 |
|2022-01-05|1 |
+----------+-------+
Now I need to copy this table(table1) and paste this into a new table(table2) with a different schema. The new table should look like this
+----+----------+-------+
|type|date |count |
+----+----------+-------+
|Typ1|2022-01-07|2 |
|Typ1|2022-01-06|0 |
|Typ1|2022-01-05|1 |
+----+----------+-------+
Now the problems are:
- I cannot use cqlsh COPY command as the scheme of both the tables is different.
- I cannot manually add the data to table2 because the table1 has 1000s of rows
The schema of the tables are:
Table1:
CREATE TABLE table1(
date date PRIMARY KEY,
count bigint
);
Table2:
CREATE TABLE table2(
type text,
date date ,
count bigint,
PRIMARY KEY(type, date)
);