1. Intro

  • 启动CassandraEntry;

2. Construct Data

  • CassandraProduct.cql

create keyspace if not exists elf with replication={'class':'SimpleStrategy','replication_factor':1};

use elf;

create table if not exists elf.product(
	product_id uuid primary key,
	product_name varchar,
	product_memo text,
   	product_state boolean
);

select * from elf.product;
truncate table elf.product;

# 不要换行,不要随意添加空格,否则cql语法可能无法通过;
# UUID:Java UUID.randomUUID()形式,Cassandra uuid()形式;

insert into elf.product(product_id,product_name,product_memo,product_state)values(uuid(),'JanusGraph','Graph,Open Source',true);
insert into elf.product(product_id,product_name,product_memo,product_state)values(uuid(),'Cassandra','Wide Column,Vector,Multi Model',true);
insert into elf.product(product_id,product_name,product_memo,product_state)values(uuid(),'Presto','Relational,Open Source,Big Data',false);
insert into elf.product(product_id,product_name,product_memo,product_state)values(uuid(),'Trino','Relational,Document,Spatial,TS,KV',true);
insert into elf.product(product_id,product_name,product_memo,product_state)values(uuid(),'Weaviate','Vector,AI,Real Time',true);
insert into elf.product(product_id,product_name,product_memo,product_state)values(uuid(),'Milvus','Vector,Similarity Search,ML',true);
insert into elf.product(product_id,product_name,product_memo,product_state)values(uuid(),'Qdrant','Vector,NN,Semantic Matching',true);
insert into elf.product(product_id,product_name,product_memo,product_state)values(uuid(),'ElasticSearch','Search,Document,Spatial,Vector',true);
+--------------------------------------+-----------------------------------+---------------+--------------+
| product_id                           | product_memo                      | product_name  | product_state|
|--------------------------------------+-----------------------------------+---------------+--------------|
| 29af0738-4a17-4571-90cd-700ab8995db7 |       Vector,Similarity Search,ML |        Milvus |          True|
| 3a3415aa-8dfa-42fa-9723-0142960b687a |   Relational,Open Source,Big Data |        Presto |         False|
| 741e5240-8a7b-40fa-b07c-e88b3638bf36 |                 Graph,Open Source |    JanusGraph |          True|
| 63608ee0-eaf1-41cf-970e-04238a556103 |               Vector,AI,Real Time |      Weaviate |          True|
| 6d580a60-daba-46cc-b3d9-6061aa48f0ff |    Search,Document,Spatial,Vector | ElasticSearch |          True|
| d4760f62-9b76-4c40-8a56-8c1e7214dfdd |    Wide Column,Vector,Multi Model |     Cassandra |          True|
| ddfe8f96-c49f-4ad0-899a-9b3b484419d8 |       Vector,NN,Semantic Matching |        Qdrant |          True|
| cb99a803-2443-48ec-accb-5262ef9bc429 | Relational,Document,Spatial,TS,KV |         Trino |          True|
+--------------------------------------+-----------------------------------+---------------+--------------+

3. Visualization Tool

  • 安装DbVisualizer V24.1.4;

  • Tool ☞ Driver Manager ☞ 搜索Cassandra
    ☞ 右键选择Create User Driver from Template

DbVisualizerCassandra01
  • Name:Custom Cassandra

  • Url:jdbc:cassandra://192.168.0.123:9042

  • Driver Class:com.simba.cassandra.jdbc42.Driver

  • 点击右侧地球仪:Download/Update driver for remote artifact,
    下载完成后关闭窗口;

  • 点击左上角加号 ☞ Create Database Connection:

DbVisualizerCassandra02
  • SQL Commander ☞ New SQL Commander ☞ select * from elf.product;

DbVisualizerCassandra03

4. Create Product

{
    "productName":"Cassandra",
    "productMemo":"Wide Column,Vector,Multi Model",
    "productState":true
}

{
    "productId": "24672630-4ca4-424b-8fc5-c20f1400074b",
    "productName": "Cassandra",
    "productMemo": "Wide Column,Vector,Multi Model",
    "productState": true
}

5. Update Product

{
    "productName":"Cassandra-Update",
    "productMemo":"Wide Column,Vector,Multi Model",
    "productState":true
}

{
    "productId": "24672630-4ca4-424b-8fc5-c20f1400074b",
    "productName": "Cassandra-Update",
    "productMemo": "Wide Column,Vector,Multi Model",
    "productState": true
}

6. Retrieve By Id

{
    "productId": "29af0738-4a17-4571-90cd-700ab8995db7",
    "productName": "Milvus",
    "productMemo": "Vector,Similarity Search,ML",
    "productState": true
}

7. Retrieve All Product

[
    {
        "productId": "29af0738-4a17-4571-90cd-700ab8995db7",
        "productName": "Milvus",
        "productMemo": "Vector,Similarity Search,ML",
        "productState": true
    },
    {
        "productId": "3a3415aa-8dfa-42fa-9723-0142960b687a",
        "productName": "Presto",
        "productMemo": "Relational,Open Source,Big Data",
        "productState": false
    },
    {
        "productId": "741e5240-8a7b-40fa-b07c-e88b3638bf36",
        "productName": "JanusGraph",
        "productMemo": "Graph,Open Source",
        "productState": true
    },
    {
        "productId": "63608ee0-eaf1-41cf-970e-04238a556103",
        "productName": "Weaviate",
        "productMemo": "Vector,AI,Real Time",
        "productState": true
    },
    {
        "productId": "6d580a60-daba-46cc-b3d9-6061aa48f0ff",
        "productName": "ElasticSearch",
        "productMemo": "Search,Document,Spatial,Vector",
        "productState": true
    },
    {
        "productId": "d4760f62-9b76-4c40-8a56-8c1e7214dfdd",
        "productName": "Cassandra",
        "productMemo": "Wide Column,Vector,Multi Model",
        "productState": true
    },
    {
        "productId": "ddfe8f96-c49f-4ad0-899a-9b3b484419d8",
        "productName": "Qdrant",
        "productMemo": "Vector,NN,Semantic Matching",
        "productState": true
    },
    {
        "productId": "cb99a803-2443-48ec-accb-5262ef9bc429",
        "productName": "Trino",
        "productMemo": "Relational,Document,Spatial,TS,KV",
        "productState": true
    }
]
select * from elf.product where product_memo like '%vector%';
InvalidRequest: Error from server: code=2200 [Invalid query]
msg="like restriction only support on properly indexed column
product_memo LIKE '%vector%' is not valid."

9. Delete All Product

10. Retrieve By State

[
    {
        "productId": "29af0738-4a17-4571-90cd-700ab8995db7",
        "productName": "Milvus",
        "productMemo": "Vector,Similarity Search,ML",
        "productState": true
    },
    {
        "productId": "741e5240-8a7b-40fa-b07c-e88b3638bf36",
        "productName": "JanusGraph",
        "productMemo": "Graph,Open Source",
        "productState": true
    },
    {
        "productId": "63608ee0-eaf1-41cf-970e-04238a556103",
        "productName": "Weaviate",
        "productMemo": "Vector,AI,Real Time",
        "productState": true
    },
    {
        "productId": "d4760f62-9b76-4c40-8a56-8c1e7214dfdd",
        "productName": "Cassandra",
        "productMemo": "Wide Column,Vector,Multi Model",
        "productState": true
    },
    {
        "productId": "ddfe8f96-c49f-4ad0-899a-9b3b484419d8",
        "productName": "Qdrant",
        "productMemo": "Vector,NN,Semantic Matching",
        "productState": true
    },
    {
        "productId": "cb99a803-2443-48ec-accb-5262ef9bc429",
        "productName": "Trino",
        "productMemo": "Relational,Document,Spatial,TS,KV",
        "productState": true
    }
]