Database Reference
In-Depth Information
.............+....................+.........+...............
foo@bar.com | {756716f7-2e54...} |
null |
['GOOG', 'FB']
UPDATE users
SET top_tickers = top_tickers - ['FB']
WHERE email = 'foo@bar.com';
email
| portfolios
| tickers |
top_tickers
.............+....................+.........+...............
foo@bar.com | {756716f7-2e54...} |
null |
['GOOG']
Maps
Cassandra maps provide a dictionary-like object with keys and values. Maps are
useful when you want to store table-like data within a single Cassandra row. This
can help eliminate the pain of not having joins, or remove the need to store JSON
data within a single column value. Listing 3.11 shows an example of using maps.
Listing 3.11 Example of Using Maps
Click here to view code image
ALTER TABLE users ADD ticker_updates map<text,
timestamp>;
UPDATE users
SET ticker_updates = { 'AMZN':'2013-06-13
11:42:12' }
WHERE email = 'foo@bar.com';
email | portfolios | ticker_updates
.............+................+.....................................
foo@bar.com | {756716f7...} | {'AMZN':
'2013-06-13 11:42:12-0400'}
UPDATE users
SET ticker_updates['GOOG'] = '2013-06-13
12:51:31'
WHERE email = 'foo@bar.com';
email | portfolios | ticker_updates
.............+................+.....................................
 
Search WWH ::




Custom Search