cassandra.metadata - Schema and Ring Topology¶
-
cassandra.metadata.cql_keywords¶ Set of keywords in CQL.
Derived from .../cassandra/src/java/org/apache/cassandra/cql3/Cql.g
-
cassandra.metadata.cql_keywords_unreserved¶ Set of unreserved keywords in CQL.
Derived from .../cassandra/src/java/org/apache/cassandra/cql3/Cql.g
-
cassandra.metadata.cql_keywords_reserved¶ Set of reserved keywords in CQL.
-
class
cassandra.metadata.Metadata[source]¶ Holds a representation of the cluster schema and topology.
-
cluster_name= None¶ The string name of the cluster.
-
partitioner= None¶ The string name of the partitioner for the cluster.
-
keyspaces= None¶ A map from keyspace names to matching
KeyspaceMetadatainstances.
-
export_schema_as_string()[source]¶ Returns a string that can be executed as a query in order to recreate the entire schema. The string is formatted to be human readable.
-
get_replicas(keyspace, key)[source]¶ Returns a list of
Hostinstances that are replicas for a given partition key.
-
Schemas¶
-
class
cassandra.metadata.KeyspaceMetadata[source]¶ A representation of the schema for a single keyspace.
-
name= None¶ The string name of the keyspace.
-
durable_writes= True¶ A boolean indicating whether durable writes are enabled for this keyspace or not.
-
replication_strategy= None¶ A
ReplicationStrategysubclass object.
-
tables= None¶ A map from table names to instances of
TableMetadata.
-
indexes= None¶ A dict mapping index names to
IndexMetadatainstances.
-
user_types= None¶ A map from user-defined type names to instances of
UserType.New in version 2.1.0.
-
functions= None¶ A map from user-defined function signatures to instances of
Function.New in version 2.6.0.
-
aggregates= None¶ A map from user-defined aggregate signatures to instances of
Aggregate.New in version 2.6.0.
-
-
class
cassandra.metadata.UserType[source]¶ A user defined type, as created by
CREATE TYPEstatements.User-defined types were introduced in Cassandra 2.1.
New in version 2.1.0.
-
keyspace= None¶ The string name of the keyspace in which this type is defined.
-
name= None¶ The name of this type.
-
field_names= None¶ An ordered list of the names for each field in this user-defined type.
-
field_types= None¶ An ordered list of the types for each field in this user-defined type.
-
-
class
cassandra.metadata.Function[source]¶ A user defined function, as created by
CREATE FUNCTIONstatements.User-defined functions were introduced in Cassandra 2.2
New in version 2.6.0.
-
keyspace= None¶ The string name of the keyspace in which this function is defined
-
name= None¶ The name of this function
-
type_signature= None¶ An ordered list of the types for each argument to the function
-
argument_names= None¶ An ordered list of the names of each argument to the function
-
return_type= None¶ Return type of the function
-
language= None¶ Language of the function body
-
body= None¶ Function body string
-
called_on_null_input= None¶ Flag indicating whether this function should be called for rows with null values (convenience function to avoid handling nulls explicitly if the result will just be null)
-
-
class
cassandra.metadata.Aggregate[source]¶ A user defined aggregate function, as created by
CREATE AGGREGATEstatements.Aggregate functions were introduced in Cassandra 2.2
New in version 2.6.0.
-
keyspace= None¶ The string name of the keyspace in which this aggregate is defined
-
name= None¶ The name of this aggregate
-
type_signature= None¶ An ordered list of the types for each argument to the aggregate
-
state_func= None¶ Name of a state function
-
state_type= None¶ Type of the aggregate state
-
final_func= None¶ Name of a final function
-
initial_condition= None¶ Initial condition of the aggregate
-
return_type= None¶ Return type of the aggregate
-
-
class
cassandra.metadata.TableMetadata[source]¶ A representation of the schema for a single table.
-
primary_key¶ A list of
ColumnMetadatarepresenting the components of the primary key for this table.
-
is_cql_compatible¶ A boolean indicating if this table can be represented as CQL in export
-
keyspace= None¶ An instance of
KeyspaceMetadata.
-
name= None¶ The string name of the table.
-
partition_key= None¶ A list of
ColumnMetadatainstances representing the columns in the partition key for this table. This will always hold at least one column.
-
clustering_key= None¶ A list of
ColumnMetadatainstances representing the columns in the clustering key for this table. These are all of theprimary_keycolumns that are not in thepartition_key.Note that a table may have no clustering keys, in which case this will be an empty list.
-
columns= None¶ A dict mapping column names to
ColumnMetadatainstances.
-
indexes= None¶ A dict mapping index names to
IndexMetadatainstances.
-
options= None¶ A dict mapping table option names to their specific settings for this table.
-
triggers= None¶ A dict mapping trigger names to
TriggerMetadatainstances.
-
-
class
cassandra.metadata.ColumnMetadata[source]¶ A representation of a single column in a table.
-
table= None¶ The
TableMetadatathis column belongs to.
-
name= None¶ The string name of this column.
-
data_type= None¶ The data type for the column in the form of an instance of one of the type classes in
cassandra.cqltypes.
-
index= None¶ If an index exists on this column, this is an instance of
IndexMetadata, otherwiseNone.
-
is_static= False¶ If this column is static (available in Cassandra 2.1+), this will be
True, otherwiseFalse.
-
typestring¶ A string representation of the type for this column, such as “varchar” or “map<string, int>”.
-
-
class
cassandra.metadata.IndexMetadata[source]¶ A representation of a secondary index on a column.
-
column= None¶ The column (
ColumnMetadata) this index is on.
-
name= None¶ A string name for the index.
-
index_type= None¶ A string representing the type of index.
-
index_options= {}¶ A dict of index options.
-
Tokens and Ring Topology¶
-
class
cassandra.metadata.TokenMap[source]¶ Information about the layout of the ring.
-
class
cassandra.metadata.Murmur3Token(token)[source]¶ A token for
Murmur3Partitioner.token should be an int or string representing the token.
-
class
cassandra.metadata.MD5Token(token)[source]¶ A token for
RandomPartitioner.token should be an int or string representing the token.
-
class
cassandra.metadata.BytesToken(token_string)[source]¶ A token for
ByteOrderedPartitioner.token_string should be string representing the token.
-
cassandra.metadata.ReplicationStrategy¶ alias of
_ReplicationStrategy
-
class
cassandra.metadata.SimpleStrategy(options_map)[source]¶ -
replication_factor= None¶ The replication factor for this keyspace.
-