Scylla Documentation Logo Documentation
  • Server
    • Scylla Open Source
    • Scylla Enterprise
    • Scylla Alternator
  • Cloud
    • Scylla Cloud
    • Scylla Cloud Docs
  • Tools
    • Scylla Manager
    • Scylla Monitoring Stack
    • Scylla Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
Download
Menu

Caution

You're viewing documentation for a previous version of Scylla Python Driver. Switch to the latest stable version.

Scylla Python Driver API Documentation cassandra.cqlengine.management - Schema management for cqlengine

cassandra.cqlengine.management - Schema management for cqlengine¶

A collection of functions for managing keyspace and table schema.

cassandra.cqlengine.management.create_keyspace_simple(name, replication_factor, durable_writes=True, connections=None)¶

Creates a keyspace with SimpleStrategy for replica placement

If the keyspace already exists, it will not be modified.

This function should be used with caution, especially in production environments. Take care to execute schema modifications in a single context (i.e. not concurrently with other clients).

There are plans to guard schema-modifying functions with an environment-driven conditional.

Parameters
  • name (str) – name of keyspace to create

  • replication_factor (int) – keyspace replication factor, used with SimpleStrategy

  • durable_writes (bool) – Write log is bypassed if set to False

  • connections (list) – List of connection names

cassandra.cqlengine.management.create_keyspace_network_topology(name, dc_replication_map, durable_writes=True, connections=None)¶

Creates a keyspace with NetworkTopologyStrategy for replica placement

If the keyspace already exists, it will not be modified.

This function should be used with caution, especially in production environments. Take care to execute schema modifications in a single context (i.e. not concurrently with other clients).

There are plans to guard schema-modifying functions with an environment-driven conditional.

Parameters
  • name (str) – name of keyspace to create

  • dc_replication_map (dict) – map of dc_names: replication_factor

  • durable_writes (bool) – Write log is bypassed if set to False

  • connections (list) – List of connection names

cassandra.cqlengine.management.drop_keyspace(name, connections=None)¶

Drops a keyspace, if it exists.

There are plans to guard schema-modifying functions with an environment-driven conditional.

This function should be used with caution, especially in production environments. Take care to execute schema modifications in a single context (i.e. not concurrently with other clients).

Parameters
  • name (str) – name of keyspace to drop

  • connections (list) – List of connection names

cassandra.cqlengine.management.sync_table(model, keyspaces=None, connections=None)¶

Inspects the model and creates / updates the corresponding table and columns.

If keyspaces is specified, the table will be synched 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. Note that the Model.__connection__ is ignored in that case. If not specified, it will try to get the connection from the Model.

Any User Defined Types used in the table are implicitly synchronized.

This function can only add fields that are not part of the primary key.

Note that the attributes removed from the model are not deleted on the database. They become effectively ignored by (will not show up on) the model.

This function should be used with caution, especially in production environments. Take care to execute schema modifications in a single context (i.e. not concurrently with other clients).

There are plans to guard schema-modifying functions with an environment-driven conditional.

cassandra.cqlengine.management.sync_type(ks_name, type_model, connection=None)¶

Inspects the type_model and creates / updates the corresponding type.

Note that the attributes removed from the type_model are not deleted on the database (this operation is not supported). They become effectively ignored by (will not show up on) the type_model.

This function should be used with caution, especially in production environments. Take care to execute schema modifications in a single context (i.e. not concurrently with other clients).

There are plans to guard schema-modifying functions with an environment-driven conditional.

cassandra.cqlengine.management.drop_table(model, keyspaces=None, connections=None)¶

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. Note that the Model.__connection__ is ignored in that case. If not specified, it will try to get the connection from the Model.

This function should be used with caution, especially in production environments. Take care to execute schema modifications in a single context (i.e. not concurrently with other clients).

There are plans to guard schema-modifying functions with an environment-driven conditional.

PREVIOUS
cassandra.cqlengine.connection - Connection management for cqlengine
NEXT
cassandra.cqlengine.usertype - Model classes for User Defined Types
  • 3.22.3
    • 3.25.4
    • 3.24.8
    • 3.22.3
    • 3.21.0
  • API Documentation
    • cassandra - Exceptions and Enums
    • cassandra.cluster - Clusters and Sessions
    • cassandra.policies - Load balancing and Failure Handling Policies
    • cassandra.auth - Authentication
    • cassandra.graph - Graph Statements, Options, and Row Factories
    • cassandra.metadata - Schema and Ring Topology
    • cassandra.metrics - Performance Metrics
    • cassandra.query - Prepared Statements, Batch Statements, Tracing, and Row Factories
    • cassandra.pool - Hosts and Connection Pools
    • cassandra.protocol - Protocol Features
    • cassandra.encoder - Encoders for non-prepared Statements
    • cassandra.decoder - Data Return Formats
    • cassandra.concurrent - Utilities for Concurrent Statement Execution
    • cassandra.connection - Low Level Connection Info
    • cassandra.util - Utilities
    • cassandra.timestamps - Timestamp Generation
    • cassandra.io.asyncioreactor - asyncio Event Loop
    • cassandra.io.asyncorereactor - asyncore Event Loop
    • cassandra.io.eventletreactor - eventlet-compatible Connection
    • cassandra.io.libevreactor - libev Event Loop
    • cassandra.io.geventreactor - gevent-compatible Event Loop
    • cassandra.io.twistedreactor - Twisted Event Loop
    • cassandra.cqlengine.models - Table models for object mapping
    • cassandra.cqlengine.columns - Column types for object mapping models
    • cassandra.cqlengine.query - Query and filter model objects
    • cassandra.cqlengine.connection - Connection management for cqlengine
    • cassandra.cqlengine.management - Schema management for cqlengine
    • cassandra.cqlengine.usertype - Model classes for User Defined Types
    • cassandra.datastax.graph - Graph Statements, Options, and Row Factories
    • cassandra.datastax.graph.fluent
    • cassandra.datastax.graph.fluent.query
    • cassandra.datastax.graph.fluent.predicates
  • Installation
  • Getting Started
  • Scylla Specific Features
  • Upgrading
  • Execution Profiles
  • Performance Notes
  • Paging Large Queries
  • Lightweight Transactions (Compare-and-set)
  • Security
  • User Defined Types
  • Object Mapper
    • Upgrade Guide
    • Models
    • Making Queries
    • Batch Queries
    • Connections
    • Third party integrations
    • Frequently Asked Questions
  • Working with Dates and Times
  • Scylla Cloud
  • Frequently Asked Questions
  • Create an issue
  • Edit this page
Logo
Docs Contact Us About Us
Mail List Icon Slack Icon
© ScyllaDB 2021 and © DataStax 2013-2017
Powered by Sphinx 4.3.2 & ScyllaDB Theme 1.2.2