Giter Site home page Giter Site logo

cassandra-bulkload-example's Introduction

cassandra-bulkload-example

Sample SSTable generating and bulk loading code for DataStax Using Cassandra Bulk Loader, Updated blog post. This fetches historical prices from Yahoo! Finance 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 <ip address of the node> 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à!

cassandra-bulkload-example's People

Contributors

yukim avatar tolbertam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.