Skip to content

Instantly share code, notes, and snippets.

@grom358
Created May 20, 2016 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grom358/1ae075214b2013ef1c0d93061e3480a2 to your computer and use it in GitHub Desktop.
Save grom358/1ae075214b2013ef1c0d93061e3480a2 to your computer and use it in GitHub Desktop.
create keyspace weather with replication = {'class' : 'NetworkTopologyStrategy', 'AWS_VPC_US_EAST_1' : 3};
use weather;
create table city (cityid int, avg_tmp float, description text, primary key (cityid));
insert into city (cityid, avg_tmp, description) values (1,25.5,'Mild weather');
insert into city (cityid, avg_tmp, description) values (2,3,'Cold weather');
create table forecast(cityid int,forecast_date timestamp,humidity float,chanceofrain float,wind float,feelslike int, centigrade int, primary key (cityid,forecast_date));
insert into forecast(cityid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,'2013-12-10',0.76,0.1,10,8,8);
insert into forecast(cityid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,'2013-12-11',0.90,0.3,12,4,4);
insert into forecast(cityid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,'2013-12-12',0.68,0.2,6,3,3);
insert into forecast(cityid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,'2013-12-10',0.76,0.1,10,8,8);
create table forecast_for_region(cityid int,regionid int, forecast_date timestamp,humidity float,chanceofrain float,wind float,feelslike int, centigrade int, primary key ((cityid,regionid),forecast_date));
insert into forecast_for_region(cityid,regionid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,24, '2013-12-10',0.76,0.1,10,8,8);
insert into forecast_for_region(cityid,regionid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,24,'2013-12-11',0.90,0.3,12,4,4);
insert into forecast_for_region(cityid,regionid,forecast_date,humidity,chanceofrain,wind,feelslike,centigrade) values (1,24,'2013-12-12',0.68,0.2,6,3,3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment