Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yukim/cassandra-bulkload-example
https://github.com/yukim/cassandra-bulkload-example
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/yukim/cassandra-bulkload-example
- Owner: yukim
- License: apache-2.0
- Created: 2014-09-26T15:11:10.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-21T16:23:04.000Z (almost 9 years ago)
- Last Synced: 2024-07-31T19:15:30.468Z (5 months ago)
- Language: Java
- Size: 57.6 KB
- Stars: 67
- Watchers: 9
- Forks: 34
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome-starred - cassandra-bulkload-example - (Java)
README
# cassandra-bulkload-example
Sample SSTable generating and bulk loading code for DataStax [Using Cassandra Bulk Loader, Updated](http://www.datastax.com/dev/blog/using-the-cassandra-bulk-loader-updated) blog post.
This fetches historical prices from [Yahoo! Finance](http://finance.yahoo.com/) in CSV format, and turn them to SSTables.## Generating SSTables
Run:
$ ./gradlew run
This will generate SSTable(s) under `data` directory.
## Bulk loading
First, create schema using `schema.cql` file:
$ cqlsh -f schema.cql
Then, load SSTables to Cassandra using `sstableloader`:
$ sstableloader -d data/quote/historical_prices
(assuming you have `cqlsh` and `sstableloader` in your `$PATH`)
## Check loaded data
$ bin/cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.0 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh> USE quote ;
cqlsh:quote> SELECT * FROM historical_prices WHERE ticker = 'ORCL' LIMIT 3;ticker | date | adj_close | close | high | low | open | volume
--------+--------------------------+-----------+-------+-------+-------+-------+----------
ORCL | 2014-09-25 00:00:00-0500 | 38.76 | 38.76 | 39.35 | 38.65 | 39.35 | 13287800
ORCL | 2014-09-24 00:00:00-0500 | 39.42 | 39.42 | 39.56 | 38.57 | 38.77 | 18906200
ORCL | 2014-09-23 00:00:00-0500 | 38.83 | 38.83 | 39.59 | 38.80 | 39.50 | 34353300(3 rows)
Voilà!