Was this page helpful?
ScyllaDB Python Driver is available under the Apache v2 License. ScyllaDB Python Driver is a fork of DataStax Python Driver. See Copyright here.
Caution
You're viewing documentation for a deprecated version of Scylla Python Driver. Switch to the latest stable version.
cassandra.metadata
- Schema and Ring Topology¶Set of keywords in CQL.
Derived from …/cassandra/src/java/org/apache/cassandra/cql3/Cql.g
Set of unreserved keywords in CQL.
Derived from …/cassandra/src/java/org/apache/cassandra/cql3/Cql.g
Set of reserved keywords in CQL.
Holds a representation of the cluster schema and topology.
The string name of the cluster.
The string name of the partitioner for the cluster.
A map from keyspace names to matching KeyspaceMetadata
instances.
A boolean indicating if connected to a DBaaS cluster
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.
Returns a list of Host
instances that are replicas for a given
partition key.
Returns a tuple (host, new), where host
is a Host
instance, and new
is a bool indicating whether
the host was newly added.
Find a host in the metadata for a specific endpoint. If a string inet address and port are passed,
iterate all hosts to match the broadcast_rpc_address
and
broadcast_rpc_port
attributes.
Same as get_host() but use host_id for lookup.
A representation of the schema for a single keyspace.
A boolean indicating if this is a virtual keyspace or not. Always False
for clusters running Cassandra pre-4.0 and DSE pre-6.7 versions.
Added in version 3.15.
The string name of the keyspace.
A boolean indicating whether durable writes are enabled for this keyspace or not.
A ReplicationStrategy
subclass object.
A map from table names to instances of TableMetadata
.
A dict mapping index names to IndexMetadata
instances.
A map from user-defined type names to instances of UserType
.
Added in version 2.1.0.
A map from user-defined function signatures to instances of Function
.
Added in version 2.6.0.
A map from user-defined aggregate signatures to instances of Aggregate
.
Added in version 2.6.0.
A dict mapping view names to MaterializedViewMetadata
instances.
A string indicating whether a graph engine is enabled for this keyspace (Core/Classic).
Returns a CQL query string that can be used to recreate the entire keyspace, including user-defined types and tables.
Returns a CQL query string that can be used to recreate just this keyspace, not including user-defined types and tables.
A user defined type, as created by CREATE TYPE
statements.
User-defined types were introduced in Cassandra 2.1.
Added in version 2.1.0.
The string name of the keyspace in which this type is defined.
The name of this type.
An ordered list of the names for each field in this user-defined type.
An ordered list of the types for each field in this user-defined type.
Returns a CQL query that can be used to recreate this type.
If formatted is set to True
, extra whitespace will
be added to make the query more readable.
A user defined function, as created by CREATE FUNCTION
statements.
User-defined functions were introduced in Cassandra 2.2
Added in version 2.6.0.
The string name of the keyspace in which this function is defined
The name of this function
An ordered list of the types for each argument to the function
An ordered list of the names of each argument to the function
Return type of the function
Language of the function body
Function body string
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)
Flag indicating if this function is guaranteed to produce the same result for a particular input. This is available only for DSE >=6.0.
Flag indicating if this function is guaranteed to increase or decrease monotonically on any of its arguments. This is available only for DSE >=6.0.
A list containing the argument or arguments over which this function is monotonic. This is available only for DSE >=6.0.
Returns a CQL query that can be used to recreate this function.
If formatted is set to True
, extra whitespace will
be added to make the query more readable.
A user defined aggregate function, as created by CREATE AGGREGATE
statements.
Aggregate functions were introduced in Cassandra 2.2
Added in version 2.6.0.
The string name of the keyspace in which this aggregate is defined
The name of this aggregate
An ordered list of the types for each argument to the aggregate
Name of a state function
Type of the aggregate state
Name of a final function
Initial condition of the aggregate
Return type of the aggregate
Flag indicating if this function is guaranteed to produce the same result for a particular input and state. This is available only with DSE >=6.0.
Returns a CQL query that can be used to recreate this aggregate.
If formatted is set to True
, extra whitespace will
be added to make the query more readable.
A representation of the schema for a single table.
A list of ColumnMetadata
representing the components of
the primary key for this table.
A boolean indicating if this table can be represented as CQL in export
Metadata describing configuration for table extensions
String name of this Table’s keyspace
The string name of the table.
A list of ColumnMetadata
instances representing the columns in
the partition key for this table. This will always hold at least one
column.
A list of ColumnMetadata
instances representing the columns
in the clustering key for this table. These are all of the
primary_key
columns that are not in the partition_key
.
Note that a table may have no clustering keys, in which case this will be an empty list.
A dict mapping column names to ColumnMetadata
instances.
A dict mapping index names to IndexMetadata
instances.
A dict mapping table option names to their specific settings for this table.
A dict mapping trigger names to TriggerMetadata
instances.
A dict mapping view names to MaterializedViewMetadata
instances.
A boolean indicating if this is a virtual table or not. Always False
for clusters running Cassandra pre-4.0 and DSE pre-6.7 versions.
Added in version 3.15.
Returns a string of CQL queries that can be used to recreate this table along with all indexes on it. The returned string is formatted to be human readable.
Returns a CQL query that can be used to recreate this table (index
creations are not included). If formatted is set to True
,
extra whitespace will be added to make the query human readable.
For C* 3.0+. option_maps take a superset of map names, so if nothing changes structurally, new option maps can just be appended to the list.
A boolean indicating if this table can be represented as CQL in export
A VertexMetadata
instance, if graph enabled
A EdgeMetadata
instance, if graph enabled
Returns a CQL query that can be used to recreate this table (index
creations are not included). If formatted is set to True
,
extra whitespace will be added to make the query human readable.
A representation of a single column in a table.
The TableMetadata
this column belongs to.
The string name of this column.
The CQL type for the column.
If this column is static (available in Cassandra 2.1+), this will
be True
, otherwise False
.
If this column is reversed (DESC) as in clustering order
A representation of a secondary index on a column.
A string name of the keyspace.
A string name of the table this index is on.
A string name for the index.
A string representing the kind of index (COMPOSITE, CUSTOM,…).
A dict of index options.
Returns a CQL query that can be used to recreate this index.
Returns a CQL query string that can be used to recreate this index.
A representation of a materialized view on a table
Metadata describing configuration for table extensions
A string name of the keyspace of this view.
A string name of the view.
A string name of the base table for this view.
A list of ColumnMetadata
instances representing the columns in
the partition key for this view. This will always hold at least one
column.
A list of ColumnMetadata
instances representing the columns
in the clustering key for this view.
Note that a table may have no clustering keys, in which case this will be an empty list.
A dict mapping column names to ColumnMetadata
instances.
A flag indicating whether the view was created AS SELECT *
String WHERE clause for the view select statement. From server metadata
A dict mapping table option names to their specific settings for this view.
Returns a CQL query that can be used to recreate this function.
If formatted is set to True
, extra whitespace will
be added to make the query more readable.
A representation of a vertex on a table
A string name of the keyspace.
A string name of the table this vertex is on.
A string name of the label of this vertex.
A representation of an edge on a table
A string name of the keyspace
A string name of the table this edge is on
A string name of the label of this edge
A string name of the from table of this edge (incoming vertex)
A string name of the from table label of this edge (incoming vertex)
The columns that match the partition key of the incoming vertex table.
The columns that match the clustering columns of the incoming vertex table.
A string name of the to table of this edge (outgoing vertex)
A string name of the to table label of this edge (outgoing vertex)
The columns that match the partition key of the outgoing vertex table.
The columns that match the clustering columns of the outgoing vertex table.
Information about the layout of the ring.
Abstract class representing a token.
A token for Murmur3Partitioner
.
token is an int or string representing the token.
A token for RandomPartitioner
.
A token for ByteOrderedPartitioner
.
token_string should be the string representation from the server.
alias of _ReplicationStrategy
Represent the replication factor of a keyspace.
The number of total replicas.
The number of transient replicas.
Only set if the keyspace has transient replication enabled.
The number of replicas that own a full copy of the data. This is the same than all_replicas when transient replication is not enabled.
The replication factor for this keyspace.
For backward compatibility, this returns the
cassandra.metadata.ReplicationFactor.full_replicas
value of
cassandra.metadata.SimpleStrategy.replication_factor_info
.
A cassandra.metadata.ReplicationFactor
instance.
Returns a string version of these replication options which are suitable for use in a CREATE KEYSPACE statement.
A map of datacenter names to the cassandra.metadata.ReplicationFactor
instance for that DC.
A map of datacenter names to the replication factor for that DC.
For backward compatibility, this maps to the cassandra.metadata.ReplicationFactor.full_replicas
value of the cassandra.metadata.NetworkTopologyStrategy.dc_replication_factors_info
dict.
Returns a string version of these replication options which are suitable for use in a CREATE KEYSPACE statement.
Returns a string version of these replication options which are suitable for use in a CREATE KEYSPACE statement.
Returns a dict
with the keys grouped per host. This can be
used to more accurately group by IN clause or to batch the keys per host.
If a valid replica is not found for a particular key it will be grouped under
NO_VALID_REPLICA
Example usage:
>>> result = group_keys_by_replica(
... session, "system", "peers",
... (("127.0.0.1", ), ("127.0.0.2", )))
Was this page helpful?
ScyllaDB Python Driver is available under the Apache v2 License. ScyllaDB Python Driver is a fork of DataStax Python Driver. See Copyright here.
On this page
cassandra.metadata
- Schema and Ring Topologycql_keywords
cql_keywords_unreserved
cql_keywords_reserved
Metadata
KeyspaceMetadata
KeyspaceMetadata.virtual
KeyspaceMetadata.name
KeyspaceMetadata.durable_writes
KeyspaceMetadata.replication_strategy
KeyspaceMetadata.tables
KeyspaceMetadata.indexes
KeyspaceMetadata.user_types
KeyspaceMetadata.functions
KeyspaceMetadata.aggregates
KeyspaceMetadata.views
KeyspaceMetadata.graph_engine
KeyspaceMetadata.export_as_string()
KeyspaceMetadata.as_cql_query()
UserType
Function
Aggregate
TableMetadata
TableMetadata.primary_key
TableMetadata.is_cql_compatible
TableMetadata.extensions
TableMetadata.keyspace_name
TableMetadata.name
TableMetadata.partition_key
TableMetadata.clustering_key
TableMetadata.columns
TableMetadata.indexes
TableMetadata.options
TableMetadata.triggers
TableMetadata.views
TableMetadata.virtual
TableMetadata.export_as_string()
TableMetadata.as_cql_query()
TableMetadataV3
TableMetadataDSE68
ColumnMetadata
IndexMetadata
MaterializedViewMetadata
MaterializedViewMetadata.extensions
MaterializedViewMetadata.keyspace_name
MaterializedViewMetadata.name
MaterializedViewMetadata.base_table_name
MaterializedViewMetadata.partition_key
MaterializedViewMetadata.clustering_key
MaterializedViewMetadata.columns
MaterializedViewMetadata.include_all_columns
MaterializedViewMetadata.where_clause
MaterializedViewMetadata.options
MaterializedViewMetadata.as_cql_query()
VertexMetadata
EdgeMetadata
EdgeMetadata.keyspace_name
EdgeMetadata.table_name
EdgeMetadata.label_name
EdgeMetadata.from_table
EdgeMetadata.from_label
EdgeMetadata.from_partition_key_columns
EdgeMetadata.from_clustering_columns
EdgeMetadata.to_table
EdgeMetadata.to_label
EdgeMetadata.to_partition_key_columns
EdgeMetadata.to_clustering_columns
cassandra
- Exceptions and Enumscassandra.cluster
- Clusters and Sessionscassandra.policies
- Load balancing and Failure Handling Policiescassandra.auth
- Authenticationcassandra.graph
- Graph Statements, Options, and Row Factoriescassandra.metadata
- Schema and Ring Topologycassandra.metrics
- Performance Metricscassandra.query
- Prepared Statements, Batch Statements, Tracing, and Row Factoriescassandra.pool
- Hosts and Connection Poolscassandra.protocol
- Protocol Featurescassandra.encoder
- Encoders for non-prepared Statementscassandra.decoder
- Data Return Formatscassandra.concurrent
- Utilities for Concurrent Statement Executioncassandra.connection
- Low Level Connection Infocassandra.util
- Utilitiescassandra.timestamps
- Timestamp Generationcassandra.io.asyncioreactor
- asyncio
Event Loopcassandra.io.asyncorereactor
- asyncore
Event Loopcassandra.io.eventletreactor
- eventlet
-compatible Connectioncassandra.io.libevreactor
- libev
Event Loopcassandra.io.geventreactor
- gevent
-compatible Event Loopcassandra.io.twistedreactor
- Twisted Event Loopcassandra.cqlengine.models
- Table models for object mappingcassandra.cqlengine.columns
- Column types for object mapping modelscassandra.cqlengine.query
- Query and filter model objectscassandra.cqlengine.connection
- Connection management for cqlenginecassandra.cqlengine.management
- Schema management for cqlenginecassandra.cqlengine.usertype
- Model classes for User Defined Typescassandra.datastax.graph
- Graph Statements, Options, and Row Factoriescassandra.datastax.graph.fluent
cassandra.datastax.graph.fluent.query
cassandra.datastax.graph.fluent.predicates