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

Function drop_keyspace

cassandra/cqlengine/management.py:123–151  ·  view source on GitHub ↗

Drops a keyspace, if it exists. *There are plans to guard schema-modifying functions with an environment-driven conditional.* **This function should be used with caution, especially in production environments. Take care to execute schema modifications in a single context (i.e. not

(name, connections=None)

Source from the content-addressed store, hash-verified

121
122
123def drop_keyspace(name, connections=None):
124 """
125 Drops a keyspace, if it exists.
126
127 *There are plans to guard schema-modifying functions with an environment-driven conditional.*
128
129 **This function should be used with caution, especially in production environments.
130 Take care to execute schema modifications in a single context (i.e. not concurrently with other clients).**
131
132 :param str name: name of keyspace to drop
133 :param list connections: List of connection names
134 """
135 if not _allow_schema_modification():
136 return
137
138 if connections:
139 if not isinstance(connections, (list, tuple)):
140 raise ValueError('Connections must be a list or a tuple.')
141
142 def _drop_keyspace(name, connection=None):
143 cluster = get_cluster(connection)
144 if name in cluster.metadata.keyspaces:
145 execute("DROP KEYSPACE {0}".format(metadata.protect_name(name)), connection=connection)
146
147 if connections:
148 for connection in connections:
149 _drop_keyspace(name, connection)
150 else:
151 _drop_keyspace(name)
152
153def _get_index_name_by_column(table, column_name):
154 """

Callers 9

tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
_reset_dataMethod · 0.90

Calls 2

_drop_keyspaceFunction · 0.85

Tested by 9

tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
_reset_dataMethod · 0.72