MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / _create_keyspace

Function _create_keyspace

cassandra/cqlengine/management.py:98–120  ·  view source on GitHub ↗
(name, durable_writes, strategy_class, strategy_options, connections=None)

Source from the content-addressed store, hash-verified

96
97
98def _create_keyspace(name, durable_writes, strategy_class, strategy_options, connections=None):
99 if not _allow_schema_modification():
100 return
101
102 if connections:
103 if not isinstance(connections, (list, tuple)):
104 raise ValueError('Connections must be a list or a tuple.')
105
106 def __create_keyspace(name, durable_writes, strategy_class, strategy_options, connection=None):
107 cluster = get_cluster(connection)
108
109 if name not in cluster.metadata.keyspaces:
110 log.info(format_log_context("Creating keyspace %s", connection=connection), name)
111 ks_meta = metadata.KeyspaceMetadata(name, durable_writes, strategy_class, strategy_options)
112 execute(ks_meta.as_cql_query(), connection=connection)
113 else:
114 log.info(format_log_context("Not creating keyspace %s because it already exists", connection=connection), name)
115
116 if connections:
117 for connection in connections:
118 __create_keyspace(name, durable_writes, strategy_class, strategy_options, connection=connection)
119 else:
120 __create_keyspace(name, durable_writes, strategy_class, strategy_options)
121
122
123def drop_keyspace(name, connections=None):

Callers 2

create_keyspace_simpleFunction · 0.85

Calls 2

__create_keyspaceFunction · 0.85

Tested by

no test coverage detected