Permalink
Browse files

Allow arbitrary ksdef attributes to be set

  • Loading branch information...
1 parent a5b317c commit ccaf770ebfcd0b7e2f28b87e79c996b09a45e7e4 @thobbs thobbs committed Jul 17, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 pycassa/system_manager.py
@@ -150,7 +150,7 @@ def _system_update_keyspace(self, ksdef):
def create_keyspace(self, name,
replication_strategy=SIMPLE_STRATEGY,
- strategy_options=None, durable_writes=True):
+ strategy_options=None, durable_writes=True, **ks_kwargs):
"""
Creates a new keyspace. Column families may be added to this keyspace
@@ -186,14 +186,19 @@ def create_keyspace(self, name,
strategy_class = 'org.apache.cassandra.locator.%s' % replication_strategy
else:
strategy_class = replication_strategy
+
ksdef = KsDef(name, strategy_class=strategy_class,
strategy_options=strategy_options,
cf_defs=[],
durable_writes=durable_writes)
+
+ for k, v in ks_kwargs.iteritems():
+ setattr(ksdef, k, v)
+
self._system_add_keyspace(ksdef)
def alter_keyspace(self, keyspace, replication_strategy=None,
- strategy_options=None, durable_writes=None):
+ strategy_options=None, durable_writes=None, **ks_kwargs):
"""
Alters an existing keyspace.
@@ -222,6 +227,9 @@ def alter_keyspace(self, keyspace, replication_strategy=None,
if durable_writes is not None:
ksdef.durable_writes = durable_writes
+ for k, v in ks_kwargs.iteritems():
+ setattr(ksdef, k, v)
+
self._system_update_keyspace(ksdef)
def drop_keyspace(self, keyspace):

0 comments on commit ccaf770

Please sign in to comment.