graph - Classic engine
How to create, truncate, or drop a Classic graph.
This command is used to create a new Classic graph, truncate an existing Classic graph, or drop an existing Classic graph. A Classic graph is a graph using the schema and data manipulation methods of DSE Graph 6.7 and earlier, which differs from DataStax Graph (DSG) schema and data manipulation. The Classic graph engine is deprecated in DSG 6.8 and is included mainly to facilitate migration to DSG. Contact DataStax Services for help with migration.
Synopsis
system.graph('graph_name'). replication("{'class' : 'NetworkTopologyStrategy', 'data_center_name' : replication_factor }"). systemReplication("{'class' : 'NetworkTopologyStrategy', 'data_center_name' : replication_factor }"). [ option('option_name').set('option_value'). ] engine(Classic). create() | [ifExists().]truncate() | [ifExists().]drop() | exists()
- ifExists
- Truncating and dropping a graph can check for existence with
ifExists()
before attempting the operations. - replication, systemReplication
-
Set replication class and replication factor for each datacenter using the same guidelines as for CQL keyspaces.Important: The replication factor cannot be altered once set for the graph, just as the replication factor for a keyspace cannot be changed.
DSE database settings for replication factor are used, either
SimpleStrategy
for single datacenters orNetworkTopologyStrategy
for multiple datacenters. The default replication strategy for a multi-datacenter graph isNetworkTopologyStrategy
, whereas for a single datacenter, the replication strategy will default toSimpleStrategy
.The system replication settings can be verified using thecqlsh
tool, running the CQL commandDESCRIBE keyspace food
command:DESCRIBE KEYSPACE food;
with a result:CREATE KEYSPACE food_system WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1: '3', 'dc2' : 2 } AND durable_writes = true;
systemReplication is set similarly, for the
graphName_system
keyspace that is required for Classic graphs. - create
-
Create a new graph. The
graph_name
specified is used to create two DSG Classic database keyspaces,graph_name
andgraph_name_system
, and can only contain alphanumeric and underscore characters. - truncate
-
Truncate an existing graph using this command. All data will be removed from the graph.
ifExists()
can be used to check if a graph exists before truncating it. - drop
-
Drop an existing graph using this command. All data and schema will be lost. For better performance, truncate a graph before dropping it.
ifExists()
can be used to check if a graph exists before dropping it. - exists
-
Check existence of a graph using this command.
Examples
system.graph('food_simple'). classicEngine(). create()Either
classicEngine()
or engine(Classic)
can be used to make a
Classic graph. The resulting
list:==>food_simple
_name
and
system replicaton factor for the graph_name_system
. It can also include
other options to set schema
settings.system.graph('food_classic'). replication("{'class' : 'NetworkTopologyStrategy', 'SearchGraph' : 1 }"). systemReplication("{'class' : 'NetworkTopologyStrategy', 'SearchGraph' : 1 }"). option('graph.schema_mode'). set('Production'). option('graph.allow_scan'). set('true'). // classicEngine() also works engine(Classic). create()
graph_name
and
graph_name_system
keyspaces.ifExists()
:system.graph('food_classic'). ifExists(). truncate()The resulting list:
==> OK
system.graph('food_classic'). ifExists(). drop()The resulting list:
==> OK
system.graph('fridge_sensor').exists()The resulting list:
==> true