Managing Schemas¶
Users of versions < 0.4, please read this post before upgrading: Breaking Changes
Once a connection has been made to Cassandra, you can use the functions in cqlengine.management
to create and delete keyspaces, as well as create and delete tables for defined models
-
cqlengine.management.
create_keyspace
(name)¶ Parameters: name (string) – the keyspace name to create creates a keyspace with the given name
-
cqlengine.management.
delete_keyspace
(name)¶ Parameters: name (string) – the keyspace name to delete deletes the keyspace with the given name
-
cqlengine.management.
sync_table
(model[, create_missing_keyspace=True])¶ Parameters: - model (
Model
) – theModel
class to make a table with - create_missing_keyspace (bool) – Optional If True, the model’s keyspace will be created if it does not already exist. Defaults to
True
syncs a python model to cassandra (creates & alters)
- model (
-
cqlengine.management.
drop_table
(model)¶ Parameters: model ( Model
) – theModel
class to delete a column family fordeletes the CQL table for the given model
See the example at Getting Started