You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/07/25 20:45:45 UTC
git commit: cqlsh: add collections support to COPY
Updated Branches:
refs/heads/cassandra-1.2 491098e79 -> 1810af404
cqlsh: add collections support to COPY
patch by Aleksey Yeschenko; reviewed by Brandon Williams for
CASSANDRA-5698
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1810af40
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1810af40
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1810af40
Branch: refs/heads/cassandra-1.2
Commit: 1810af404c85b2b63b99483b1dcb26cf5121aaac
Parents: 491098e
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Thu Jul 25 21:44:40 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Thu Jul 25 21:44:40 2013 +0300
----------------------------------------------------------------------
CHANGES.txt | 4 ++++
bin/cqlsh | 2 +-
pylib/cqlshlib/formatting.py | 20 +++++++++++++-------
3 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1810af40/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 71a956b..858bbf8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,7 @@
+1.2.8
+ * cqlsh: add collections support to COPY (CASSANDRA-5698)
+
+
1.2.7
* if no seeds can be a reached a node won't start in a ring by itself (CASSANDRA-5768)
* add cassandra.unsafesystem property (CASSANDRA-5704)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1810af40/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 643324c..48cc492 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -32,7 +32,7 @@ exit 1
from __future__ import with_statement
description = "CQL Shell for Apache Cassandra"
-version = "3.1.4"
+version = "3.1.5"
from StringIO import StringIO
from itertools import groupby
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1810af40/pylib/cqlshlib/formatting.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py
index 87f692b..b571033 100644
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@ -112,8 +112,10 @@ def format_value_blob(val, colormap, **_):
bval = '0x' + ''.join('%02x' % ord(c) for c in val)
return colorme(bval, colormap, 'blob')
-def format_python_formatted_type(val, colormap, color):
+def format_python_formatted_type(val, colormap, color, quote=False):
bval = str(val)
+ if quote:
+ bval = "'%s'" % bval
return colorme(bval, colormap, color)
@formatter_for('decimal')
@@ -127,8 +129,8 @@ def format_value_uuid(val, colormap, **_):
formatter_for('timeuuid')(format_value_uuid)
@formatter_for('inet')
-def formatter_value_inet(val, colormap, **_):
- return format_python_formatted_type(val, colormap, 'inet')
+def formatter_value_inet(val, colormap, quote=False, **_):
+ return format_python_formatted_type(val, colormap, 'inet', quote=quote)
@formatter_for('boolean')
def format_value_boolean(val, colormap, **_):
@@ -152,8 +154,10 @@ formatter_for('varint')(format_integer_type)
formatter_for('counter')(format_integer_type)
@formatter_for('timestamp')
-def format_value_timestamp(val, colormap, time_format, **_):
+def format_value_timestamp(val, colormap, time_format, quote=False, **_):
bval = strftime(time_format, val)
+ if quote:
+ bval = "'%s'" % bval
return colorme(bval, colormap, 'timestamp')
def strftime(time_format, seconds):
@@ -174,10 +178,12 @@ def strftime(time_format, seconds):
return formatted[:-5] + sign + '{0:0=2}{1:0=2}'.format(hours, minutes)
@formatter_for('text')
-def format_value_text(val, encoding, colormap, **_):
+def format_value_text(val, encoding, colormap, quote=False, **_):
escapedval = val.replace(u'\\', u'\\\\')
escapedval = unicode_controlchars_re.sub(_show_control_chars, escapedval)
bval = escapedval.encode(encoding, 'backslashreplace')
+ if quote:
+ bval = "'%s'" % bval
displaywidth = wcwidth.wcswidth(bval.decode(encoding))
return color_text(bval, colormap, displaywidth)
@@ -188,7 +194,7 @@ def format_simple_collection(subtype, val, lbracket, rbracket, encoding,
colormap, time_format, float_precision, nullval):
subs = [format_value(subtype, sval, encoding=encoding, colormap=colormap,
time_format=time_format, float_precision=float_precision,
- nullval=nullval)
+ nullval=nullval, quote=True)
for sval in val]
bval = lbracket + ', '.join(sval.strval for sval in subs) + rbracket
lb, sep, rb = [colormap['collection'] + s + colormap['reset']
@@ -212,7 +218,7 @@ def format_value_map(val, encoding, colormap, time_format, float_precision, subt
def subformat(v, subtype):
return format_value(subtype, v, encoding=encoding, colormap=colormap,
time_format=time_format, float_precision=float_precision,
- nullval=nullval)
+ nullval=nullval, quote=True)
subkeytype, subvaltype = subtypes
subs = [(subformat(k, subkeytype), subformat(v, subvaltype)) for (k, v) in sorted(val.items())]