First we load our extension and configure matplotlib to display graphs inline.

Before using this notebook, be sure to run:

cqlsh -f setup_tutorial.cql

In [ ]:
%load_ext cql
%reload_ext cql
%matplotlib inline
%keyspace tutorial

In [ ]:
%tables

In [ ]:
%desc sensor_data

In [ ]:
%%cql
CREATE TABLE user (
    user_id uuid primary key,
    name text
);

In [ ]:
%cql insert into user (user_id, name) values (cf76125b-9353-4df1-a208-319885d0b888, 'Jon')
%cql select * from user;

In [ ]:
%cql truncate sensor_data;
%cql INSERT INTO sensor_data (sensor_id, date_created, reading) values (cf76125b-9353-4df1-a208-319885d0b888, now(), 1)
%cql INSERT INTO sensor_data (sensor_id, date_created, reading) values (cf76125b-9353-4df1-a208-319885d0b888, now(), 3)
%cql INSERT INTO sensor_data (sensor_id, date_created, reading) values (cf76125b-9353-4df1-a208-319885d0b888, now(), 10)
%cql select * from sensor_data where sensor_id = cf76125b-9353-4df1-a208-319885d0b888;

In [ ]:
%trace select reading from sensor_data where sensor_id = cf76125b-9353-4df1-a208-319885d0b888;

In [ ]:
%%cql
select *
from 
sensor_data 
where sensor_id = cf76125b-9353-4df1-a208-319885d0b888;

In [ ]:
%%histogram 
select reading 
from 
sensor_data 
where sensor_id = cf76125b-9353-4df1-a208-319885d0b888;

This notebook is available in the repo!