pycassa.contrib.stubs
– Pycassa Stubs¶
A functional set of stubs to be used for unit testing.
Projects that use pycassa and need to run an automated unit test suite on a system like Jenkins can use these stubs to emulate interactions with Cassandra without spinning up a cluster locally.
-
class
pycassa.contrib.stubs.
ColumnFamilyStub
(pool=None, column_family=None, rows=None)¶ Functional ColumnFamily stub object.
Acts very similar to a remote column family, supporting a basic version of the API. When instantiated, it registers itself with the supplied (stub) connection pool.
-
get
(key[, columns][, column_start][, column_finish][, column_reversed][, column_count][, include_timestamp])¶ Get a value from the column family stub.
-
multiget
(keys[, columns][, column_start][, column_finish][, column_reversed][, column_count][, include_timestamp])¶ Get multiple key values from the column family stub.
-
get_range
([columns][, include_timestamp])¶ Currently just gets all values from the column family.
-
get_indexed_slices
(index_clause[, columns], include_timestamp])¶ Grabs rows that match a pycassa index clause.
See
pycassa.index.create_index_clause()
for creating such an index clause.
-
insert
(key, columns[, timestamp])¶ Insert data to the column family stub.
-
remove
(key[, columns])¶ Remove a key from the column family stub.
-
truncate
()¶ Clears all data from the column family stub.
-
batch
(self)¶ Returns itself.
-
-
class
pycassa.contrib.stubs.
ConnectionPoolStub
¶ Connection pool stub.
Notes created column families in
self.column_families
.
-
class
pycassa.contrib.stubs.
SystemManagerStub
¶ Functional System Manager stub object.
Records when column families, columns, and indexes have been created. To see what has been recorded, look at
self.column_families
.-
create_column_family
(keyspace, table_name)¶ Create a column family and record its existence.
-
alter_column
(keyspace, table_name, column_name, column_type)¶ Alter a column, recording its name and type.
-
create_index
(keyspace, table_name, column_name, column_type)¶ Create an index, recording its name and type.
-
describe_schema_versions
()¶ Describes the schema based on a hash of the stub system state.
-