class TestUTF8(object): key = types.LexicalUUIDType() strcol = types.AsciiType(default='default') intcol = types.LongType(default=0) floatcol = types.FloatType(default=0.0) datetimecol = types.DateType() def __str__(self): return str(map(str, [self.strcol, self.intcol, self.floatcol, self.datetimecol])) def __eq__(self, other): return self.__dict__ == other.__dict__ def __ne__(self, other): return self.__dict__ != other.__dict__
def createUTF8ColumnFamily(sys_manager, keyspace, tablename, ts_table=False): """Create column family with UTF8Type comparator, value and key.""" # Default options for the tree-storage tables kw_options = {'super': False, 'comparator_type': pycassa_types.UTF8Type(), 'key_validation_class': pycassa_types.UTF8Type(), 'default_validation_class': pycassa_types.UTF8Type()} # A ts* table needs to have a bunch of different settings since that's where # the actual data is going to be stored # - Use DTCS compaction to delete old data (requires 2.0.11+) # - Set the correct CQL table fields # - Set gc_grace_seconds to 0 since we never update/delete data once it's written # - DTCS options: # - timestamp_resolution: MICROSECONDS due to Pycassa and CQL's default timestamp resolution # - tombstone_threhold: 0.1 as an attempt to be more aggressive when it comes to compaction # - base_time_seconds: 60 groups sstables into 60 second blocks # CASSANDRA-8417 indicates that 60 seconds is a more reasonable default # - tombstone_compaction_interval: 1 is a Cassandra default. Included in case it needs tuning if ts_table: table_options = { 'compaction_strategy': 'DateTieredCompactionStrategy', 'compaction_strategy_options': { 'timestamp_resolution': 'MICROSECONDS', 'max_sstable_age_days': '365', 'tombstone_compaction_interval': '1', 'tombstone_threshold': '0.1', 'base_time_seconds': '60'}, 'comparator_type': pycassa_types.LongType(), 'key_validation_class': pycassa_types.UTF8Type(), 'default_validation_class': pycassa_types.FloatType(), 'gc_grace_seconds': '1800'} kw_options.update(table_options) sys_manager.create_column_family( keyspace, tablename, **kw_options )
This was originally called 'RackAwareStrategy'. """ KEYS_INDEX = IndexType.KEYS """ A secondary index type where each indexed value receives its own row """ BYTES_TYPE = types.BytesType() LONG_TYPE = types.LongType() INT_TYPE = types.IntegerType() ASCII_TYPE = types.AsciiType() UTF8_TYPE = types.UTF8Type() TIME_UUID_TYPE = types.TimeUUIDType() LEXICAL_UUID_TYPE = types.LexicalUUIDType() COUNTER_COLUMN_TYPE = types.CounterColumnType() DOUBLE_TYPE = types.DoubleType() FLOAT_TYPE = types.FloatType() DECIMAL_TYPE = types.DecimalType() BOOLEAN_TYPE = types.BooleanType() DATE_TYPE = types.DateType() class SystemManager(object): """ Lets you examine and modify schema definitions as well as get basic information about the cluster. This class is mainly designed to be used manually in a python shell, not as part of a program, although it can be used that way. All operations which modify a keyspace or column family definition will block until the cluster reports that all nodes have accepted the modification.