diff --git a/CHANGES.txt b/CHANGES.txt index 63dfa5592d..69293bb01b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -189,6 +189,7 @@ Merged from 3.0: * Correct log message for statistics of offheap memtable flush (CASSANDRA-12776) * Explicitly set locale for string validation (CASSANDRA-12541,CASSANDRA-12542,CASSANDRA-12543,CASSANDRA-12545) Merged from 2.2: + * cqlsh copy-from: encode column names to avoid primary key parsing errors (CASSANDRA-12909) * Temporarily fix bug that creates commit log when running offline tools (CASSANDRA-8616) * Reduce granuality of OpOrder.Group during index build (CASSANDRA-12796) * Test bind parameters and unset parameters in InsertUpdateIfConditionTest (CASSANDRA-12980) diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py index 5d6eb43f15..07613812c8 100644 --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@ -1817,9 +1817,10 @@ class ImportConversion(object): # these functions are used for non-prepared statements to protect values with quotes if required self.protectors = [self._get_protector(t) for t in self.coltypes] - def _get_protector(self, t): + @staticmethod + def _get_protector(t): if t in ('ascii', 'text', 'timestamp', 'date', 'time', 'inet'): - return lambda v: unicode(protect_value(v), self.encoding) + return lambda v: protect_value(v) else: return lambda v: v @@ -2237,7 +2238,7 @@ class ImportProcess(ChildProcess): ChildProcess.__init__(self, params=params, target=self.run) self.skip_columns = params['skip_columns'] - self.valid_columns = params['valid_columns'] + self.valid_columns = [c.encode(self.encoding) for c in params['valid_columns']] self.skip_column_indexes = [i for i, c in enumerate(self.columns) if c in self.skip_columns] options = params['options']