1.2 KiB
Managing Schmas
cqlengine.management
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
create_keyspace(name)
- param name
-
the keyspace name to create
- type name
-
string
creates a keyspace with the given name
delete_keyspace(name)
- param name
-
the keyspace name to delete
- type name
-
string
deletes the keyspace with the given name
create_table(model [, create_missing_keyspace=True])
- param model
-
the
~cqlengine.model.Modelclass to make a table with - type model
-
~cqlengine.model.Model - param create_missing_keyspace
-
Optional If True, the model's keyspace will be created if it does not already exist. Defaults to
True - type create_missing_keyspace
-
bool
creates a CQL table for the given model
delete_table(model)
- param model
-
the
~cqlengine.model.Modelclass to delete a column family for - type model
-
~cqlengine.model.Model
deletes the CQL table for the given model
See the example at getting-started