cassandra 数据建模与电子商务和连接
cassandra data modeling with e commerce and joins
我是 cassandra 的新手,我来自 postgresql。我搜索了 cassandra e commerce data modeling 并找到了这个例子:
CREATE TABLE Customer (
cust_id text,
first_name text,
last_name text,
registered_on timestamp,
PRIMARY KEY (cust_id));
CREATE TABLE Product (
prdt_id text,
title text,
PRIMARY KEY (prdt_id));
CREATE TABLE Customer_By_Liked_Product (
liked_prdt_id text,
liked_on timestamp,
title text,
cust_id text,
first_name text,
last_name text,
PRIMARY KEY (prdt_id, liked_on));
CREATE TABLE Product_Liked_By_Customer (
cust_id text,
first_name text,
last_name text,
liked_prdt_id text,
liked_on timestamp,
title text,
PRIMARY KEY (cust_id, liked_on));
我现在的问题是,我怎样才能加入 tables?如果连接不工作,你将如何与两个 tables 交谈?
您是否为每个 table 提出请求?像这样:
select * from customer where userid = 5;
row['userid'];
select * from product where userid = row['userid'];
and so on..
因为我听说连接在 cassandra 中不可用,所以我必须像上面的例子那样做任何请求,或者有其他解决方案吗?
非常感谢您的帮助
是的,你是对的,Cassandra 不支持连接。在 Cassandra 中,您可以根据查询设计架构。所以你必须有一个模式来回答你的查询,或者你必须像上面的例子那样进行多个查询。 Cassandra 中没有连接。
我是 cassandra 的新手,我来自 postgresql。我搜索了 cassandra e commerce data modeling 并找到了这个例子:
CREATE TABLE Customer (
cust_id text,
first_name text,
last_name text,
registered_on timestamp,
PRIMARY KEY (cust_id));
CREATE TABLE Product (
prdt_id text,
title text,
PRIMARY KEY (prdt_id));
CREATE TABLE Customer_By_Liked_Product (
liked_prdt_id text,
liked_on timestamp,
title text,
cust_id text,
first_name text,
last_name text,
PRIMARY KEY (prdt_id, liked_on));
CREATE TABLE Product_Liked_By_Customer (
cust_id text,
first_name text,
last_name text,
liked_prdt_id text,
liked_on timestamp,
title text,
PRIMARY KEY (cust_id, liked_on));
我现在的问题是,我怎样才能加入 tables?如果连接不工作,你将如何与两个 tables 交谈?
您是否为每个 table 提出请求?像这样:
select * from customer where userid = 5;
row['userid'];
select * from product where userid = row['userid'];
and so on..
因为我听说连接在 cassandra 中不可用,所以我必须像上面的例子那样做任何请求,或者有其他解决方案吗?
非常感谢您的帮助
是的,你是对的,Cassandra 不支持连接。在 Cassandra 中,您可以根据查询设计架构。所以你必须有一个模式来回答你的查询,或者你必须像上面的例子那样进行多个查询。 Cassandra 中没有连接。