Files
deb-python-cassandra-driver/docs/topics/manage_schemas.rst
2014-06-27 14:26:16 -07:00

1.5 KiB

Managing Schemas

Users of versions < 0.4, please read this post before upgrading: Breaking Changes

cqlengine.connection

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

sync_table(model [, create_missing_keyspace=True])

param model

the ~cqlengine.model.Model class 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

syncs a python model to cassandra (creates & alters)

drop_table(model)

param model

the ~cqlengine.model.Model class 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