NoSql、Hbase、Cassandra概念化数据库
假设我有 1 到 N 的关系,例如
Student , College.
学生属性:
Name,Surname,CollegeFKey,
大学属性:
CollegeKey,Other,Other.
假设我有一个程序从纯文本文件中读取学生和考试。而且,在这个文件中,我复制了大学和重复的学生。
就像在非规范化表中一样:
CollegeId,Other,Other,Name,Surname,CollegeFkey.
例如
1,x,y,Mike,M,1
1,x,y,R,P,1
...
...
...
,你看,在这种情况下,我必须始终检查在我的规范化数据库中,我仍然没有在 Table College 中插入 2 次键 1。
我如何在 Hbase 或 Cassandra 中解决这个问题?我的意思是,如果我有 10000 个表和行,我不想检查每个主键,然后检查每个 FK,如果插入正常?
我该如何解决这个问题?我可以使用 no-sql 数据库直接在非规范化数据中工作吗? 你能给我链接一个解决这个问题的例子吗?
Suppose I have a relationship 1 to N, for example
Student , College.
Student Attributes:
Name,Surname,CollegeFKey,
College attributes:
CollegeKey,Other,Other.
Suppose that I have a program which read students and Exams from a plain text file. And, on this file I have duplicated Colleges and Duplicated Studends.
Like in denormalized tables:
CollegeId,Other,Other,Name,Surname,CollegeFkey.
e.g.
1,x,y,Mike,M,1
1,x,y,R,P,1
...
...
...
You see, I have to check in this case always that in my normalized db, I have still not inserted in the Table College 2 times the key 1.
How can I solve this in Hbase or Cassandra? I mean, if I have 10000.. tables and rows, I don't want check for every Primary Key and then for every FK, if it was inserted OK?
How can I solve that? I can use no-sql db for work directly in de-normalized datas?
Can you link me to an example that solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 Cassandra http://wiki.apache.org/cassandra/ 与某些高级语言客户端一起使用(我使用 Hector for java https://github.com/rantav/hector)。在 Cassandra 中,您将描述 ColumnFamily College,在此 ColumnFamily 中,您编写包含学生信息的 Student 列。
You can use Cassandra http://wiki.apache.org/cassandra/ with some high level language client (I use Hector for java https://github.com/rantav/hector). In Cassandra you will describe ColumnFamily College in this ColumnFamily you write Student columns which contains information about students.