Re: Alter composite column

2018-01-18 Thread Alexander Dejanovski
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 
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 
> 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 :
>>
>>> 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 
>>> 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 :

> 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


Re: Alter composite column

2018-01-18 Thread Joel Samuelsson
Yeah, I want column4 to appear in each cell name (rather than just once)
which I think would be the same as altering the primary key.

2018-01-18 12:18 GMT+01:00 Nicolas Guyomar :

> 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 
> 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 :
>>
>>> 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 
>>> 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 :

> 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
>


>>>
>>
>


Re: Alter composite column

2018-01-18 Thread Nicolas Guyomar
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 
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 :
>
>> 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 
>> 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 :
>>>
 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

>>>
>>>
>>
>


Re: Alter composite column

2018-01-18 Thread Joel Samuelsson
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 :

> 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 
> 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 :
>>
>>> 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
>>>
>>
>>
>


Re: Alter composite column

2018-01-18 Thread Nicolas Guyomar
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 
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 :
>
>> 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
>>
>
>


Re: Alter composite column

2018-01-18 Thread Alexander Dejanovski
Hi Joel,

Sadly it's not possible to alter the primary key of a table in Cassandra.
That would require to rewrite all data on disk to match the new
partitioning and/or clustering.

You need to create a new table and transfer all data from the old one
programmatically.

Cheers,

Le jeu. 18 janv. 2018 à 11:14, Joel Samuelsson 
a écrit :

> 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 :
>
>> 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


Re: Alter composite column

2018-01-18 Thread Joel Samuelsson
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 :

> 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
>


Alter composite column

2018-01-12 Thread Joel Samuelsson
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