def __unicode__(self): from cql.query import cql_quote if isinstance(self.value, bool): return 'true' if self.value else 'false' elif isinstance(self.value, (list, tuple)): return '[' + ', '.join([cql_quote(v) for v in self.value]) + ']' elif isinstance(self.value, dict): return '{' + ', '.join([cql_quote(k) + ':' + cql_quote(v) for k,v in self.value.items()]) + '}' elif isinstance(self.value, set): return '{' + ', '.join([cql_quote(v) for v in self.value]) + '}' return cql_quote(self.value)
def set_initial_keyspace(self, keyspace): c = self.cursor() if self.cql_major_version >= 3: ksname = cql_quote_name(keyspace) else: ksname = cql_quote(keyspace) c.execute('USE %s' % ksname) c.close()
def __unicode__(self): from cql.query import cql_quote return '(' + ', '.join([cql_quote(v) for v in self.value]) + ')'