You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2012/12/14 15:04:13 UTC

[jira] [Resolved] (CASSANDRA-5069) cassandra "show schema" command does not export correctly primary key created via cqlsh

     [ https://issues.apache.org/jira/browse/CASSANDRA-5069?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne resolved CASSANDRA-5069.
-----------------------------------------

    Resolution: Won't Fix

The "id" is a metadata use for CQL3 but has no sense for thrift and is thus not exposed (on purpose). Yes, exporting CQL3 definition to thrift loses some information.

If you really need to do this back and forth between CQL3 and thrift (which is not recommended), you can always restore the missing metadata manually in the CQL3 side by using an 'ALTER ... RENAME' query (see http://www.datastax.com/dev/blog/thrift-to-cql3 for more details). 
                
> cassandra "show schema" command does not export correctly primary key created via cqlsh
> ---------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-5069
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5069
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 1.1.6
>            Reporter: Thierry Boileau
>
> 1/ create a column family as follow in cqlsh
> CREATE TABLE "Test" (
> 	"id" varchar,
> 	"email" varchar,
> 	PRIMARY KEY ("id")
> );
> 2/ with cassandra-cli, use the "show schema" command:
> create column family Test
>   with column_type = 'Standard'
>   and comparator = 'UTF8Type'
>   and default_validation_class = 'UTF8Type'
>   and key_validation_class = 'UTF8Type'
>   and read_repair_chance = 0.1
>   and dclocal_read_repair_chance = 0.0
>   and gc_grace = 864000
>   and min_compaction_threshold = 4
>   and max_compaction_threshold = 32
>   and replicate_on_write = true
>   and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
>   and caching = 'KEYS_ONLY'
>   and column_metadata = [
>     {column_name : 'email',
>     validation_class : UTF8Type,
>     index_name : 'authorizedemail_email',
>     index_type : 0}]
>   and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'};
> NB : note there is no "id" column definition
> 3/ recreate the column family
> using the creation script generated by show schema
> 4/ select * from "Test";
>  key                                  | email                         | 
> --------------------------------------+-------------------------------+
> The "id" column has been renammed to "key".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira