Compact storage only allows one column outside of the primary key so you'll
definitely need to recreate your table if you want to add columns.

Le jeu. 18 janv. 2018 à 12:18, Nicolas Guyomar <nicolas.guyo...@gmail.com>
a écrit :

> Well it should be as easy as following this :
> https://docs.datastax.com/en/cql/3.1/cql/cql_using/use_alter_add.html
>
> But I'm worried that your initial requirement was to change the clustering
> key, as Alexander stated, you need to create a new table and transfer your
> data in it
>
> On 18 January 2018 at 12:03, Joel Samuelsson <samuelsson.j...@gmail.com>
> wrote:
>
>> It was indeed created with C* 1.X
>> Do you have any links or otherwise on how I would add the column4? I
>> don't want to risk destroying my data.
>>
>> Best regards,
>> Joel
>>
>> 2018-01-18 11:18 GMT+01:00 Nicolas Guyomar <nicolas.guyo...@gmail.com>:
>>
>>> Hi Joel,
>>>
>>> You cannot alter a table primary key.
>>>
>>> You can however alter your existing table to only add column4 using
>>> cqlsh and cql, even if this table as created back with C* 1.X for instance
>>>
>>> On 18 January 2018 at 11:14, Joel Samuelsson <samuelsson.j...@gmail.com>
>>> wrote:
>>>
>>>> So to rephrase that in CQL terms I have a table like this:
>>>>
>>>> CREATE TABLE events (
>>>>         key text,
>>>>         column1 int,
>>>>         column2 int,
>>>>         column3 text,
>>>>         value text,
>>>>         PRIMARY KEY(key, column1, column2, column3)
>>>> ) WITH COMPACT STORAGE
>>>>
>>>> and I'd like to change it to:
>>>> CREATE TABLE events (
>>>>         key text,
>>>>         column1 int,
>>>>         column2 int,
>>>>         column3 text,
>>>>         column4 text,
>>>>         value text,
>>>>         PRIMARY KEY(key, column1, column2, column3, column4)
>>>> ) WITH COMPACT STORAGE
>>>>
>>>> Is this possible?
>>>> Best regards,
>>>> Joel
>>>>
>>>> 2018-01-12 16:53 GMT+01:00 Joel Samuelsson <samuelsson.j...@gmail.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have an older system (C* 2.1) using Thrift tables on which I want to
>>>>> alter a column composite. Right now it looks like (int, int, string) but I
>>>>> want it to be (int, int, string, string). Is it possible to do this on a
>>>>> live cluster without deleting the old data? Can you point me to some
>>>>> documentation about this? I can't seem to find it any more.
>>>>>
>>>>> Best regards,
>>>>> Joel
>>>>>
>>>>
>>>>
>>>
>>
> --
-----------------
Alexander Dejanovski
France
@alexanderdeja

Consultant
Apache Cassandra Consulting
http://www.thelastpickle.com

Reply via email to