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)
Parameters:model (Model) – the Model class to make a table with

syncs a python model to cassandra (creates & alters)

cqlengine.management.drop_table(model)
Parameters:model (Model) – the Model class to delete a column family for

deletes the CQL table for the given model

See the example at Getting Started