Professional Documents
Culture Documents
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracles products remains at the sole discretion of Oracle.
Agenda
Introduce Table based data modeling feature
Discuss its benefits How to use it (DDL & DML)
Architecture
Demo
Primary Key
userId firstName
Value
lastName
How to Describe It ?
DDL
kv-> show tables -name User { "type" : "table", name" : "User", "id" : "r", "description" : A sample user table, "shardKey" : [ "userId" ], "primaryKey" : [ "userId" ], "fields" : [
"lastName" : Smith}
11
Create instance of table object we wish to read from Create instance of index object that we will search Set search key Call iterator to scan index Convert results to JSON object, take JSON object and convert back to Row
}
12
name" : "Email", "namespace" : "com.companyX.email.avro", "type" : "record", "fields": [ {"name": "from", "type": "string", "default": ""}, {"name": "to", "type": "string", "default": ""}, {"name": "sender", "type": "string", "default": ""}, {"name": "cc", "type": "string", "default": ""}, {"name": "subject", "type": "string", "default": ""}, {name: msgBody, type: string, default: }
]}
13
Primary Key
UserID Folder Name Arrival Date From To
Value
Sender CC Subject Msg Body
14
15
Get a handle to the child table, through its parent table Create instance of index object and set fields we want to search on Set search key, restrict on inbox folder Call iterator to scan index Convert results to JSON object, take JSON object and convert back to Row
TableAPI ampImpl = store.getTableAPI(); Table userTable = apiImpl.getTable("User.Folder); Index index = userTable.getIndex(userFolderMessage "); IndexKey indexKey = index.createIndexKey(); indexKey.put(userId", 21"); indexKey.put(folderName", inbox"); Iterator<Row> results = apiImpl.tableIterator(indexKey, null, null); while (results.hasNext()) { Row row = results.next(); /* Convert the row to a JSON object if desired */ String jsonString = row.toJsonString(); }
16
Sender
SENT
Email
INBOX
Recipients
17
18
19
Architecture
Scalable, Available
NoSQL DB Driver Application
Shard 1
Load Balancer
Shard 2
NoSQL DB Driver
Application
Shard N
Email Client
App. Tier
Storage Tier
20
FolderDAO
Add default folders
MessageDAO
Add email message addMessage(messageTO)
UserFolderMessageDAO
Add messages to designated folders addMessage(userId, folderId, messageId)
21
23