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

Function drop_table

cassandra/cqlengine/management.py:502–521  ·  view source on GitHub ↗

Drops the table indicated by the model, if it exists. If `keyspaces` is specified, the table will be dropped for all specified keyspaces. Note that the `Model.__keyspace__` is ignored in that case. If `connections` is specified, the table will be synched for all specified connections.

(model, keyspaces=None, connections=None)

Source from the content-addressed store, hash-verified

500
501
502def drop_table(model, keyspaces=None, connections=None):
503 """
504 Drops the table indicated by the model, if it exists.
505
506 If `keyspaces` is specified, the table will be dropped for all specified keyspaces. Note that the `Model.__keyspace__` is ignored in that case.
507
508 If `connections` is specified, the table will be synched for all specified connections. Note that the `Model.__connection__` is ignored in that case.
509 If not specified, it will try to get the connection from the Model.
510
511
512 **This function should be used with caution, especially in production environments.
513 Take care to execute schema modifications in a single context (i.e. not concurrently with other clients).**
514
515 *There are plans to guard schema-modifying functions with an environment-driven conditional.*
516 """
517
518 context = _get_context(keyspaces, connections)
519 for connection, keyspace in context:
520 with query.ContextQuery(model, keyspace=keyspace) as m:
521 _drop_table(m, connection=connection)
522
523
524def _drop_table(model, connection=None):

Callers 15

tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
setUpClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90
tearDownClassMethod · 0.90

Calls 2

_get_contextFunction · 0.85
_drop_tableFunction · 0.85

Tested by 15

tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
setUpClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72