cqlsh: tab-complete key alias for ALTER CF ALTER

patch by thepaul; reviewed by slebresne for CASSANDRA-3873
This commit is contained in:
Sylvain Lebresne 2012-02-24 11:20:14 +01:00
parent 5888fcd6af
commit d64b9fff57
3 changed files with 11 additions and 8 deletions

View File

@ -1901,12 +1901,12 @@ class Shell(cmd.Cmd):
ALTER COLUMNFAMILY addamsFamily ALTER lastKnownLocation TYPE uuid;
ALTER COLUMNFAMILY ... ALTER changes the expected storage type for a
column. The column must already have a type in the column family
metadata. The column may or may not already exist in current rows-- but
be aware that no validation of existing data is done. The bytes stored
in values for that column will remain unchanged, and if existing data
is not deserializable according to the new type, this may cause your
CQL driver or interface to report errors.
column. The column must either be the key alias or already have a type
in the column family metadata. The column may or may not already exist
in current rows-- but be aware that no validation of existing data is
done. The bytes stored in values for that column will remain unchanged,
and if existing data is not deserializable according to the new type,
this may cause your CQL driver or interface to report errors.
"""
def help_alter_add(self):

View File

@ -634,7 +634,7 @@ h3. Changing the type of a typed column
bc(sample).
ALTER COLUMNFAMILY addamsFamily ALTER lastKnownLocation TYPE uuid;
@ALTER COLUMNFAMILY ... ALTER@ changes the expected storage type for a column. The column must already have a type in the column family metadata. The column may or may not already exist in current rows-- but be aware that no validation of existing data is done. The bytes stored in values for that column will remain unchanged, and if existing data is not deserializable according to the new type, this may cause your CQL driver or interface to report errors.
@ALTER COLUMNFAMILY ... ALTER@ changes the expected storage type for a column. The column must either be the key alias or already have a type in the column family metadata. The column may or may not already exist in current rows-- but be aware that no validation of existing data is done. The bytes stored in values for that column will remain unchanged, and if existing data is not deserializable according to the new type, this may cause your CQL driver or interface to report errors.
h3. Adding a typed column

View File

@ -726,7 +726,10 @@ def alter_table_cf_completer(ctxt, cass):
@completer_for('alterInstructions', 'existcol')
def alter_table_col_completer(ctxt, cass):
cfdef = cass.get_columnfamily(cql_dequote(ctxt.get_binding('cf')))
return map(maybe_cql_escape, [md.name for md in cfdef.column_metadata])
cols = [md.name for md in cfdef.column_metadata]
if cfdef.key_alias is not None:
cols.append(cfdef.key_alias)
return map(maybe_cql_escape, cols)
explain_completion('alterInstructions', 'newcol', '<new_column_name>')