text 在Cassandra DB中存储邮件元数据。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 在Cassandra DB中存储邮件元数据。相关的知识,希望对你有一定的参考价值。


CREATE KEYSPACE mail 
  WITH replication = {
  	'class': 'SimpleStrategy', 
  	'replication_factor': 1
  };

CREATE TABLE mailbox ( 
	box_id text, year int, 
	received timestamp, 
	folder text,
	sender text, 
	receipients list<text>,
	subject text,
	body text,
PRIMARY KEY ((box_id, year), received);

INSERT INTO mailbox (box_id, year, folder, received, sender, receipients, body) 
VALUES ('torchwood', 2018, 'Inbox', dateof(now()), 'kk@example.com', ['dr.who@torchwood.org'], 'Sample text');

INSERT INTO mailbox (box_id, year, folder, received, sender, receipients, body) 
VALUES ('torchwood', 2018, 'Inbox', dateof(now()), 'ab@c.de', ['dr.who@torchwood.org'], 'Sample text');

INSERT INTO mailbox (box_id, year, folder, received, sender, receipients, body) 
VALUES ('torchwood', 2018, 'Inbox', dateof(now()), 'pi@schneierfacts.com', ['dr.who@torchwood.org'], 'Sample text');

INSERT INTO mailbox (box_id, year, folder, received, sender, receipients, body) 
VALUES ('torchwood', 2018, 'Inbox', dateof(now()), 'root@kroes.ch', ['dr.who@torchwood.org'], 'Sample text');

SELECT * from mailbox WHERE box_id = 'torchwood' and year = 2018 and folder='Inbox' ORDER BY folder DESC;

以上是关于text 在Cassandra DB中存储邮件元数据。的主要内容,如果未能解决你的问题,请参考以下文章

围绕电子邮件系统的 Cassandra 数据建模

如何在启用TDE的情况下查询Cassandra中的敏感数据?

为啥我们没有在 Spark-Cassandra-Connector 中定义一个 ReaderBuilder 来从 cassandra DB 读取数据

Cassandra 分区问题

LARAVEL:发送存储在 DB 中的邮件,使用 WYSIWYG 编辑器制作

cassandra 存储list数组