Scylla Specific Features¶
New Cluster Helpers¶
cluster.is_shard_aware()
New method available on
Cluster
allowing to check whether the remote cluster supports shard awareness (bool)
from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect()
if cluster.is_shard_aware():
print("connected to a scylla cluster")
cluster.shard_aware_stats()
New method available on
Cluster
allowing to check the status of shard aware connections to all available hosts (dict)
from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect()
stats = cluster.shard_aware_stats()
if all([v["shards_count"] == v["connected"] for v in stats.values()]):
print("successfully connected to all shards of all scylla nodes")
New Table Attributes¶
in_memory
flagNew flag available on
TableMetadata.options
to indicate that it is an In Memory table
Note
in memory tables is a feature existing only in Scylla Enterprise
from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect()
session.execute("""
CREATE KEYSPACE IF NOT EXISTS keyspace1
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
""")
session.execute("""
CREATE TABLE IF NOT EXISTS keyspace1.standard1 (
key blob PRIMARY KEY,
"C0" blob
) WITH in_memory=true AND compaction={'class': 'InMemoryCompactionStrategy'}
""")
cluster.refresh_table_metadata("keyspace1", "standard1")
assert cluster.metadata.keyspaces["keyspace1"].tables["standard1"].options["in_memory"] == True