quandl_cassandra_models 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/Gemfile +4 -0
- data/LICENSE +7 -0
- data/README.md +7 -0
- data/Rakefile +11 -0
- data/UPGRADE.md +34 -0
- data/config/cassandra.yml +41 -0
- data/lib/quandl/cassandra/models.rb +16 -0
- data/lib/quandl/cassandra/models/column.rb +42 -0
- data/lib/quandl/cassandra/models/column/read.rb +49 -0
- data/lib/quandl/cassandra/models/column/read/collapse.rb +41 -0
- data/lib/quandl/cassandra/models/column/read/column.rb +19 -0
- data/lib/quandl/cassandra/models/column/read/data.rb +59 -0
- data/lib/quandl/cassandra/models/column/read/offset.rb +104 -0
- data/lib/quandl/cassandra/models/column/read/row.rb +20 -0
- data/lib/quandl/cassandra/models/column/read/select_columns.rb +63 -0
- data/lib/quandl/cassandra/models/column/read/transform.rb +53 -0
- data/lib/quandl/cassandra/models/column/read/trim.rb +14 -0
- data/lib/quandl/cassandra/models/column/read/type.rb +25 -0
- data/lib/quandl/cassandra/models/column/write.rb +25 -0
- data/lib/quandl/cassandra/models/column/write/group_data_by_column.rb +36 -0
- data/lib/quandl/cassandra/models/column/write/group_data_by_frequency.rb +24 -0
- data/lib/quandl/cassandra/models/column/write/insert_column_attributes.rb +22 -0
- data/lib/quandl/cassandra/models/column/write/insert_columns.rb +9 -0
- data/lib/quandl/cassandra/models/column_attribute.rb +11 -0
- data/lib/quandl/cassandra/models/data.rb +18 -0
- data/lib/quandl/cassandra/models/data/search.rb +105 -0
- data/lib/quandl/cassandra/models/dataset.rb +87 -0
- data/lib/quandl/cassandra/models/dataset/columns.rb +63 -0
- data/lib/quandl/cassandra/models/dataset_attribute.rb +6 -0
- data/lib/quandl/cassandra/models/multiset.rb +55 -0
- data/lib/quandl/cassandra/models/version.rb +7 -0
- data/migrations/20131105204200_create_datasets.rb +18 -0
- data/migrations/20131105204201_create_columns.rb +18 -0
- data/migrations/20131105204202_create_dataset_attributes.rb +17 -0
- data/migrations/20131105204203_create_column_attributes.rb +17 -0
- data/quandl_cassandra_models.gemspec +28 -0
- data/spec/expectations/string.rb +5 -0
- data/spec/expectations/time.rb +5 -0
- data/spec/factories/dataset.rb +8 -0
- data/spec/lib/quandl/cassandra/models/column/read_spec.rb +27 -0
- data/spec/lib/quandl/cassandra/models/column/write/group_data_by_frequency_spec.rb +28 -0
- data/spec/lib/quandl/cassandra/models/column/write_spec.rb +23 -0
- data/spec/lib/quandl/cassandra/models/column_attribute_spec.rb +16 -0
- data/spec/lib/quandl/cassandra/models/column_spec.rb +17 -0
- data/spec/lib/quandl/cassandra/models/data_spec.rb +105 -0
- data/spec/lib/quandl/cassandra/models/dataset/collapse_spec.rb +44 -0
- data/spec/lib/quandl/cassandra/models/dataset/column_spec.rb +24 -0
- data/spec/lib/quandl/cassandra/models/dataset/persistence_spec.rb +25 -0
- data/spec/lib/quandl/cassandra/models/dataset/row_spec.rb +26 -0
- data/spec/lib/quandl/cassandra/models/dataset/transform_spec.rb +16 -0
- data/spec/lib/quandl/cassandra/models/dataset/trim_spec.rb +74 -0
- data/spec/lib/quandl/cassandra/models/dataset/update_spec.rb +37 -0
- data/spec/lib/quandl/cassandra/models/dataset_attribute_spec.rb +18 -0
- data/spec/lib/quandl/cassandra/models/dataset_spec.rb +117 -0
- data/spec/lib/quandl/cassandra/models/multiset/collapse_spec.rb +122 -0
- data/spec/lib/quandl/cassandra/models/multiset/columns_spec.rb +57 -0
- data/spec/lib/quandl/cassandra/models/multiset/data_spec.rb +25 -0
- data/spec/lib/quandl/cassandra/models/multiset/transform_spec.rb +69 -0
- data/spec/spec_helper.rb +40 -0
- data/tasks/migrations.rake +14 -0
- metadata +212 -0
| @@ -0,0 +1,122 @@ | |
| 1 | 
            +
            # encoding: utf-8
         | 
| 2 | 
            +
            require 'spec_helper'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe Multiset do
         | 
| 5 | 
            +
              
         | 
| 6 | 
            +
              context "collapse" do
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
                let(:d1){ create(:dataset) }
         | 
| 9 | 
            +
                let(:d2){ create(:dataset) }
         | 
| 10 | 
            +
                subject { Multiset.with_columns("#{d2.id.to_i}.1,#{d1.id.to_i}.1,#{d2.id.to_i}.3,#{d1.id.to_i}.2") }
         | 
| 11 | 
            +
              
         | 
| 12 | 
            +
                it "should change the scope" do
         | 
| 13 | 
            +
                  scope = subject.data.collapse('weekly')
         | 
| 14 | 
            +
                  scope.attributes[:collapse].should eq :weekly
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
                
         | 
| 17 | 
            +
                it "should accept daily" do
         | 
| 18 | 
            +
                  subject.data.collapse(:daily).count.should eq 60
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
                
         | 
| 21 | 
            +
                it "should accept weekly" do
         | 
| 22 | 
            +
                  subject.data.collapse(:weekly).count.should be < 12
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
                
         | 
| 25 | 
            +
                it "should accept monthly" do
         | 
| 26 | 
            +
                  subject.data.collapse(:monthly).count.should be < 4
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
              
         | 
| 29 | 
            +
                it "should accept annual" do
         | 
| 30 | 
            +
                  subject.data.collapse(:annual).count.should eq 1
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
                
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
              
         | 
| 35 | 
            +
              context "multiple frequencies" do
         | 
| 36 | 
            +
                
         | 
| 37 | 
            +
                let(:dataset_daily)   { create(:dataset, data: Quandl::Fabricate::Data.rand( rows: 10, columns: 3, nils: false ).to_csv ) }
         | 
| 38 | 
            +
                let(:dataset_monthly) { create(:dataset, data: Quandl::Fabricate::Data.rand( rows: 10, columns: 3, frequency: :monthly, nils: false ).to_csv ) }
         | 
| 39 | 
            +
                let(:dataset_annual)  { create(:dataset, data: Quandl::Fabricate::Data.rand( rows: 10, columns: 3, frequency: :annual, nils: false ).to_csv ) }
         | 
| 40 | 
            +
                
         | 
| 41 | 
            +
                context "without collapse" do
         | 
| 42 | 
            +
                  
         | 
| 43 | 
            +
                  subject { Multiset.with_columns("#{dataset_daily.id.to_i}.1,#{dataset_monthly.id.to_i}.1,#{dataset_annual.id.to_i}.1") }
         | 
| 44 | 
            +
                  
         | 
| 45 | 
            +
                  describe "#data" do
         | 
| 46 | 
            +
                    
         | 
| 47 | 
            +
                    it "should be correct" do
         | 
| 48 | 
            +
                      row = subject.data[0]
         | 
| 49 | 
            +
                      row[1].should eq Dataset.find(dataset_daily.id).data[0][1]
         | 
| 50 | 
            +
                      row[2].should eq Dataset.find(dataset_monthly.id).data[0][1]
         | 
| 51 | 
            +
                      row[3].should eq Dataset.find(dataset_annual.id).data[0][1]
         | 
| 52 | 
            +
                    end
         | 
| 53 | 
            +
                    
         | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
                  
         | 
| 56 | 
            +
                  describe "#column_frequencies" do
         | 
| 57 | 
            +
                    
         | 
| 58 | 
            +
                    it "should be correct" do
         | 
| 59 | 
            +
                      subject.column_frequencies[0].should eq 'daily'
         | 
| 60 | 
            +
                      subject.column_frequencies[1].should eq 'monthly'
         | 
| 61 | 
            +
                      subject.column_frequencies[2].should eq 'annual'
         | 
| 62 | 
            +
                    end
         | 
| 63 | 
            +
                    
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
                  
         | 
| 66 | 
            +
                end
         | 
| 67 | 
            +
                
         | 
| 68 | 
            +
                context "collapsed to annual" do
         | 
| 69 | 
            +
                  
         | 
| 70 | 
            +
                  subject { 
         | 
| 71 | 
            +
                    m = Multiset.with_columns("#{dataset_daily.id.to_i}.1,#{dataset_monthly.id.to_i}.1,#{dataset_annual.id.to_i}.1") 
         | 
| 72 | 
            +
                    m.data.collapse(:annual)
         | 
| 73 | 
            +
                    m
         | 
| 74 | 
            +
                  }
         | 
| 75 | 
            +
                  
         | 
| 76 | 
            +
                  it "should return the data" do
         | 
| 77 | 
            +
                    data_hash = subject.data.scoped.collapse(:annual).to_table.to_h
         | 
| 78 | 
            +
                    # check daily
         | 
| 79 | 
            +
                    daily_row = Dataset.find(dataset_daily.id).data.column(1).collapse(:annual)
         | 
| 80 | 
            +
                    daily_date = daily_row[0][0]
         | 
| 81 | 
            +
                    data_hash[daily_date][0].should eq daily_row[0][1]
         | 
| 82 | 
            +
                    # check monthly
         | 
| 83 | 
            +
                    monthly_row = Dataset.find(dataset_monthly.id).data.column(1).collapse(:annual)
         | 
| 84 | 
            +
                    monthly_date = monthly_row[0][0]
         | 
| 85 | 
            +
                    data_hash[monthly_date][1].should eq monthly_row[0][1]
         | 
| 86 | 
            +
                    # check annual
         | 
| 87 | 
            +
                    annual_row = Dataset.find(dataset_annual.id).data.column(1).collapse(:annual)
         | 
| 88 | 
            +
                    annual_date = annual_row[0][0]
         | 
| 89 | 
            +
                    data_hash[annual_date][2].should eq annual_row[0][1]
         | 
| 90 | 
            +
                  end
         | 
| 91 | 
            +
                  
         | 
| 92 | 
            +
                end
         | 
| 93 | 
            +
                
         | 
| 94 | 
            +
                context "collapsed to monthly" do
         | 
| 95 | 
            +
                  
         | 
| 96 | 
            +
                  subject { 
         | 
| 97 | 
            +
                    m = Multiset.with_columns("#{dataset_daily.id.to_i}.1,#{dataset_monthly.id.to_i}.1,#{dataset_annual.id.to_i}.1") 
         | 
| 98 | 
            +
                    m.data.collapse(:monthly)
         | 
| 99 | 
            +
                    m
         | 
| 100 | 
            +
                  }
         | 
| 101 | 
            +
                  
         | 
| 102 | 
            +
                  it "should return the data" do
         | 
| 103 | 
            +
                    data_hash = subject.data.to_table.to_h
         | 
| 104 | 
            +
                    # check daily
         | 
| 105 | 
            +
                    daily_row = Dataset.find(dataset_daily.id).data.column(1).collapse(:monthly)
         | 
| 106 | 
            +
                    daily_date = daily_row[0][0]
         | 
| 107 | 
            +
                    data_hash[daily_date][0].should eq daily_row[0][1]
         | 
| 108 | 
            +
                    # check monthly
         | 
| 109 | 
            +
                    monthly_row = Dataset.find(dataset_monthly.id).data.column(1).collapse(:monthly)
         | 
| 110 | 
            +
                    monthly_date = monthly_row[0][0]
         | 
| 111 | 
            +
                    data_hash[monthly_date][1].should eq monthly_row[0][1]
         | 
| 112 | 
            +
                    # check annual
         | 
| 113 | 
            +
                    annual_row = Dataset.find(dataset_annual.id).data.column(1).collapse(:monthly)
         | 
| 114 | 
            +
                    annual_date = annual_row[0][0]
         | 
| 115 | 
            +
                    data_hash[annual_date][2].should eq annual_row[0][1]
         | 
| 116 | 
            +
                  end
         | 
| 117 | 
            +
                  
         | 
| 118 | 
            +
                end
         | 
| 119 | 
            +
                
         | 
| 120 | 
            +
              end
         | 
| 121 | 
            +
              
         | 
| 122 | 
            +
            end
         | 
| @@ -0,0 +1,57 @@ | |
| 1 | 
            +
             # encoding: utf-8
         | 
| 2 | 
            +
            require 'spec_helper'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe Multiset do
         | 
| 5 | 
            +
              
         | 
| 6 | 
            +
              context "columns" do
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
                let(:d1){ create(:dataset) }
         | 
| 9 | 
            +
                let(:d2){ create(:dataset) }
         | 
| 10 | 
            +
                
         | 
| 11 | 
            +
                let(:multiset){ Multiset.with_columns("#{d2.id.to_i}.2,#{d1.id.to_i}.2,#{d2.id.to_i}.4,#{d1.id.to_i}.3") }
         | 
| 12 | 
            +
                
         | 
| 13 | 
            +
                describe ".with_columns" do
         | 
| 14 | 
            +
                  subject{ multiset }
         | 
| 15 | 
            +
                  
         | 
| 16 | 
            +
                  describe "#column_ids" do
         | 
| 17 | 
            +
                    subject{ multiset.column_ids }
         | 
| 18 | 
            +
                    its([0]){ should be_same_string_as Dataset.find(d2.id).column_ids[1] }
         | 
| 19 | 
            +
                    its([1]){ should be_same_string_as Dataset.find(d1.id).column_ids[1] }
         | 
| 20 | 
            +
                    its([2]){ should be_same_string_as Dataset.find(d2.id).column_ids[3] }
         | 
| 21 | 
            +
                    its([3]){ should be_same_string_as Dataset.find(d1.id).column_ids[2] }
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
                  
         | 
| 24 | 
            +
                  describe "#data" do
         | 
| 25 | 
            +
                    subject{ multiset.data.to_a }
         | 
| 26 | 
            +
                    its(:count){ should eq 60 }
         | 
| 27 | 
            +
                    
         | 
| 28 | 
            +
                    describe "#first" do
         | 
| 29 | 
            +
                      subject{ multiset.data.to_a.first }
         | 
| 30 | 
            +
                      its(:count){ should eq 5 }
         | 
| 31 | 
            +
                    end
         | 
| 32 | 
            +
                    
         | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
                  
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
                
         | 
| 37 | 
            +
                it "should limit the data" do
         | 
| 38 | 
            +
                  data = Multiset.with_columns("#{d1.id.to_i}.2,#{d2.id.to_i}.1").data.limit(10)
         | 
| 39 | 
            +
                  data.count.should eq 10
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
                
         | 
| 42 | 
            +
                it "should return the correct data" do
         | 
| 43 | 
            +
                  d = Multiset.with_columns("#{d1.id.to_i}.2,#{d2.id.to_i}.1")
         | 
| 44 | 
            +
                  d.data[0][1].should eq Dataset.find(d1.id).data[0][2]
         | 
| 45 | 
            +
                  d.data[0][2].should eq Dataset.find(d2.id).data[0][1]
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
                
         | 
| 48 | 
            +
                it "should transform the data" do
         | 
| 49 | 
            +
                  d = Multiset.with_columns("#{d1.id.to_i}.2,#{d2.id.to_i}.1")
         | 
| 50 | 
            +
                  data = d.data.limit(1).transform(:rdiff)
         | 
| 51 | 
            +
                  plain_data = Multiset.with_columns("#{d1.id.to_i}.2,#{d2.id.to_i}.1").data.limit(1)
         | 
| 52 | 
            +
                  data[0][1].should_not eq plain_data[0][1]
         | 
| 53 | 
            +
                end
         | 
| 54 | 
            +
                
         | 
| 55 | 
            +
              end
         | 
| 56 | 
            +
              
         | 
| 57 | 
            +
            end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            # encoding: utf-8
         | 
| 2 | 
            +
            require 'spec_helper'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe Multiset do
         | 
| 5 | 
            +
              
         | 
| 6 | 
            +
              context "data" do
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
                let(:d1){ create(:dataset) }
         | 
| 9 | 
            +
                let(:d2){ create(:dataset) }
         | 
| 10 | 
            +
                subject { Multiset.with_columns("#{d2.id.to_i}.1,#{d1.id.to_i}.1,#{d2.id.to_i}.3,#{d1.id.to_i}.2") }
         | 
| 11 | 
            +
                # wait for cassandra to be eventually consistent
         | 
| 12 | 
            +
              
         | 
| 13 | 
            +
                it "should have columns" do
         | 
| 14 | 
            +
                  subject.columns.count.should eq 4
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              
         | 
| 17 | 
            +
                it "should have data" do
         | 
| 18 | 
            +
                  subject.data.count.should eq 60
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
                
         | 
| 21 | 
            +
                its(:to_json){ should be_present }
         | 
| 22 | 
            +
                
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
              
         | 
| 25 | 
            +
            end
         | 
| @@ -0,0 +1,69 @@ | |
| 1 | 
            +
            # encoding: utf-8
         | 
| 2 | 
            +
            require 'spec_helper'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe Multiset do
         | 
| 5 | 
            +
              
         | 
| 6 | 
            +
              context "transform" do
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
                let(:d1){ create(:dataset) }
         | 
| 9 | 
            +
                let(:d2){ create(:dataset) }
         | 
| 10 | 
            +
                subject { Multiset.with_columns("#{d2.id.to_i}.1,#{d1.id.to_i}.1,#{d2.id.to_i}.3,#{d1.id.to_i}.2") }
         | 
| 11 | 
            +
                
         | 
| 12 | 
            +
                let(:data_table){ subject.data.scoped.to_table }
         | 
| 13 | 
            +
                
         | 
| 14 | 
            +
                it "should change the scope" do
         | 
| 15 | 
            +
                  scope = subject.data.transform('rdiff')
         | 
| 16 | 
            +
                  scope.attributes[:transform].should eq :rdiff
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
                
         | 
| 19 | 
            +
                it "should default" do
         | 
| 20 | 
            +
                  subject.data.should_not eq data_table.transform(:rdiff).sort_descending!
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
                
         | 
| 23 | 
            +
                it "should rdiff" do
         | 
| 24 | 
            +
                  subject.data.transform(:rdiff).should eq data_table.transform(:rdiff).sort_descending!
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
                
         | 
| 27 | 
            +
                it "should diff" do
         | 
| 28 | 
            +
                  subject.data.transform(:diff).should eq data_table.transform(:diff).sort_descending!
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
                
         | 
| 31 | 
            +
                it "should cumul" do
         | 
| 32 | 
            +
                  subject.data.transform(:cumul).should eq data_table.transform(:cumul).sort_descending!
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
                
         | 
| 35 | 
            +
                it "should rdiff_from" do
         | 
| 36 | 
            +
                  subject.data.transform(:rdiff_from).should eq data_table.transform(:rdiff_from).sort_descending!
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
                
         | 
| 39 | 
            +
                context "row" do
         | 
| 40 | 
            +
                  
         | 
| 41 | 
            +
                  it "should rdiff" do
         | 
| 42 | 
            +
                    subject.data.transform(:rdiff).row(10)[0].should eq data_table.transform(:rdiff).sort_descending![10]
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
                  
         | 
| 45 | 
            +
                  it "should cumul" do
         | 
| 46 | 
            +
                    subject.data.transform(:cumul).row(10)[0].should eq data_table.transform(:cumul).sort_descending![10]
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
                  
         | 
| 49 | 
            +
                  it "should rdiff_from" do
         | 
| 50 | 
            +
                    subject.data.transform(:rdiff_from).row(10)[0].should eq data_table.transform(:rdiff_from).sort_descending![10]
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
                  
         | 
| 53 | 
            +
                end
         | 
| 54 | 
            +
                
         | 
| 55 | 
            +
                context "offset" do
         | 
| 56 | 
            +
                  
         | 
| 57 | 
            +
                  it "should rdiff" do
         | 
| 58 | 
            +
                    subject.data.transform(:rdiff).offset(10).limit(10).to_a.should eq data_table.transform(:rdiff).sort_descending![10..19]
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
                  
         | 
| 61 | 
            +
                  it "should cumul" do
         | 
| 62 | 
            +
                    subject.data.transform(:cumul).offset(10).limit(10).to_a.should eq data_table.transform(:cumul).sort_descending![10..19]
         | 
| 63 | 
            +
                  end
         | 
| 64 | 
            +
                  
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
                
         | 
| 67 | 
            +
              end
         | 
| 68 | 
            +
              
         | 
| 69 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            QUANDL_LOGGER = true
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            require "rspec"
         | 
| 6 | 
            +
            require 'factory_girl'
         | 
| 7 | 
            +
            require 'pry'
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            require "quandl/cassandra"
         | 
| 10 | 
            +
            require "quandl/cassandra/models"
         | 
| 11 | 
            +
            require "quandl/fabricate"
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            # require expectations
         | 
| 14 | 
            +
            require 'rspec/expectations'
         | 
| 15 | 
            +
            Dir.glob( File.join( File.dirname(__FILE__), 'expectations/**/*.rb' ) ).each{|f| require(f) }
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            # require factories
         | 
| 18 | 
            +
            Dir.glob( File.join( File.dirname(__FILE__), 'factories/**/*.rb' ) ).each{|f| require(f) }
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            include Quandl::Cassandra::Models
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            logger = Logger.new( 'log/test.log', 2, 52428800 )
         | 
| 23 | 
            +
            logger.formatter = proc do |severity, datetime, progname, msg|
         | 
| 24 | 
            +
              "[#{datetime.strftime("%Y-%m-%d %H:%M:%S")}]: #{msg}\n"
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
            Quandl::Logger.use(logger)
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            Quandl::Cassandra.configure do |c|
         | 
| 29 | 
            +
              c.hosts         = ['192.168.33.10']
         | 
| 30 | 
            +
              c.keyspace      = 'wikiposit_test'
         | 
| 31 | 
            +
              c.consistency   = :one
         | 
| 32 | 
            +
            end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            Quandl::Cassandra::Base.models.each(&:truncate) if Quandl::Cassandra.configuration.keyspace == 'wikiposit_test'
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            RSpec.configure do |config|
         | 
| 37 | 
            +
              config.include FactoryGirl::Syntax::Methods
         | 
| 38 | 
            +
            end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            # binding.pry
         | 
| @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            require 'rails'
         | 
| 2 | 
            +
            require 'pry'
         | 
| 3 | 
            +
            require 'quandl/cassandra/models'
         | 
| 4 | 
            +
            require 'cassandra_migrations'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            RAILS_ENV = ENV['RAILS_ENV'] || 'development'
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            root = File.expand_path('../../', __FILE__)
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            CassandraMigrations.load_config_from_file( File.join(root, "config/cassandra.yml"), RAILS_ENV )
         | 
| 11 | 
            +
            CassandraMigrations.configuration.migrations_path = File.join(root, "migrations/")
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            spec = Gem::Specification.find_by_name 'cassandra_migrations'
         | 
| 14 | 
            +
            load "#{spec.gem_dir}/lib/tasks/cassandra.rake"
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,212 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: quandl_cassandra_models
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.3.6
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Blake Hilscher
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2013-11-13 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: rake
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - ~>
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '10.0'
         | 
| 20 | 
            +
              type: :development
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ~>
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '10.0'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: rspec
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - ~>
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '2.13'
         | 
| 34 | 
            +
              type: :development
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - ~>
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '2.13'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: factory_girl_rails
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - '>='
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '0'
         | 
| 48 | 
            +
              type: :development
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - '>='
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: fivemat
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ~>
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '1.2'
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - ~>
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '1.2'
         | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            +
              name: pry
         | 
| 71 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                requirements:
         | 
| 73 | 
            +
                - - '>='
         | 
| 74 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                    version: '0'
         | 
| 76 | 
            +
              type: :development
         | 
| 77 | 
            +
              prerelease: false
         | 
| 78 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            +
                requirements:
         | 
| 80 | 
            +
                - - '>='
         | 
| 81 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            +
                    version: '0'
         | 
| 83 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            +
              name: quandl_cassandra
         | 
| 85 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 | 
            +
                requirements:
         | 
| 87 | 
            +
                - - ~>
         | 
| 88 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            +
                    version: '1.1'
         | 
| 90 | 
            +
              type: :runtime
         | 
| 91 | 
            +
              prerelease: false
         | 
| 92 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 | 
            +
                requirements:
         | 
| 94 | 
            +
                - - ~>
         | 
| 95 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            +
                    version: '1.1'
         | 
| 97 | 
            +
            description: Quandl cassandra interface. CQL.
         | 
| 98 | 
            +
            email:
         | 
| 99 | 
            +
            - blake@hilscher.ca
         | 
| 100 | 
            +
            executables: []
         | 
| 101 | 
            +
            extensions: []
         | 
| 102 | 
            +
            extra_rdoc_files: []
         | 
| 103 | 
            +
            files:
         | 
| 104 | 
            +
            - .gitignore
         | 
| 105 | 
            +
            - Gemfile
         | 
| 106 | 
            +
            - LICENSE
         | 
| 107 | 
            +
            - README.md
         | 
| 108 | 
            +
            - Rakefile
         | 
| 109 | 
            +
            - UPGRADE.md
         | 
| 110 | 
            +
            - config/cassandra.yml
         | 
| 111 | 
            +
            - lib/quandl/cassandra/models.rb
         | 
| 112 | 
            +
            - lib/quandl/cassandra/models/column.rb
         | 
| 113 | 
            +
            - lib/quandl/cassandra/models/column/read.rb
         | 
| 114 | 
            +
            - lib/quandl/cassandra/models/column/read/collapse.rb
         | 
| 115 | 
            +
            - lib/quandl/cassandra/models/column/read/column.rb
         | 
| 116 | 
            +
            - lib/quandl/cassandra/models/column/read/data.rb
         | 
| 117 | 
            +
            - lib/quandl/cassandra/models/column/read/offset.rb
         | 
| 118 | 
            +
            - lib/quandl/cassandra/models/column/read/row.rb
         | 
| 119 | 
            +
            - lib/quandl/cassandra/models/column/read/select_columns.rb
         | 
| 120 | 
            +
            - lib/quandl/cassandra/models/column/read/transform.rb
         | 
| 121 | 
            +
            - lib/quandl/cassandra/models/column/read/trim.rb
         | 
| 122 | 
            +
            - lib/quandl/cassandra/models/column/read/type.rb
         | 
| 123 | 
            +
            - lib/quandl/cassandra/models/column/write.rb
         | 
| 124 | 
            +
            - lib/quandl/cassandra/models/column/write/group_data_by_column.rb
         | 
| 125 | 
            +
            - lib/quandl/cassandra/models/column/write/group_data_by_frequency.rb
         | 
| 126 | 
            +
            - lib/quandl/cassandra/models/column/write/insert_column_attributes.rb
         | 
| 127 | 
            +
            - lib/quandl/cassandra/models/column/write/insert_columns.rb
         | 
| 128 | 
            +
            - lib/quandl/cassandra/models/column_attribute.rb
         | 
| 129 | 
            +
            - lib/quandl/cassandra/models/data.rb
         | 
| 130 | 
            +
            - lib/quandl/cassandra/models/data/search.rb
         | 
| 131 | 
            +
            - lib/quandl/cassandra/models/dataset.rb
         | 
| 132 | 
            +
            - lib/quandl/cassandra/models/dataset/columns.rb
         | 
| 133 | 
            +
            - lib/quandl/cassandra/models/dataset_attribute.rb
         | 
| 134 | 
            +
            - lib/quandl/cassandra/models/multiset.rb
         | 
| 135 | 
            +
            - lib/quandl/cassandra/models/version.rb
         | 
| 136 | 
            +
            - migrations/20131105204200_create_datasets.rb
         | 
| 137 | 
            +
            - migrations/20131105204201_create_columns.rb
         | 
| 138 | 
            +
            - migrations/20131105204202_create_dataset_attributes.rb
         | 
| 139 | 
            +
            - migrations/20131105204203_create_column_attributes.rb
         | 
| 140 | 
            +
            - quandl_cassandra_models.gemspec
         | 
| 141 | 
            +
            - spec/expectations/string.rb
         | 
| 142 | 
            +
            - spec/expectations/time.rb
         | 
| 143 | 
            +
            - spec/factories/dataset.rb
         | 
| 144 | 
            +
            - spec/lib/quandl/cassandra/models/column/read_spec.rb
         | 
| 145 | 
            +
            - spec/lib/quandl/cassandra/models/column/write/group_data_by_frequency_spec.rb
         | 
| 146 | 
            +
            - spec/lib/quandl/cassandra/models/column/write_spec.rb
         | 
| 147 | 
            +
            - spec/lib/quandl/cassandra/models/column_attribute_spec.rb
         | 
| 148 | 
            +
            - spec/lib/quandl/cassandra/models/column_spec.rb
         | 
| 149 | 
            +
            - spec/lib/quandl/cassandra/models/data_spec.rb
         | 
| 150 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/collapse_spec.rb
         | 
| 151 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/column_spec.rb
         | 
| 152 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/persistence_spec.rb
         | 
| 153 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/row_spec.rb
         | 
| 154 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/transform_spec.rb
         | 
| 155 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/trim_spec.rb
         | 
| 156 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/update_spec.rb
         | 
| 157 | 
            +
            - spec/lib/quandl/cassandra/models/dataset_attribute_spec.rb
         | 
| 158 | 
            +
            - spec/lib/quandl/cassandra/models/dataset_spec.rb
         | 
| 159 | 
            +
            - spec/lib/quandl/cassandra/models/multiset/collapse_spec.rb
         | 
| 160 | 
            +
            - spec/lib/quandl/cassandra/models/multiset/columns_spec.rb
         | 
| 161 | 
            +
            - spec/lib/quandl/cassandra/models/multiset/data_spec.rb
         | 
| 162 | 
            +
            - spec/lib/quandl/cassandra/models/multiset/transform_spec.rb
         | 
| 163 | 
            +
            - spec/spec_helper.rb
         | 
| 164 | 
            +
            - tasks/migrations.rake
         | 
| 165 | 
            +
            homepage: http://blake.hilscher.ca/
         | 
| 166 | 
            +
            licenses:
         | 
| 167 | 
            +
            - MIT
         | 
| 168 | 
            +
            metadata: {}
         | 
| 169 | 
            +
            post_install_message: 
         | 
| 170 | 
            +
            rdoc_options: []
         | 
| 171 | 
            +
            require_paths:
         | 
| 172 | 
            +
            - lib
         | 
| 173 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 174 | 
            +
              requirements:
         | 
| 175 | 
            +
              - - '>='
         | 
| 176 | 
            +
                - !ruby/object:Gem::Version
         | 
| 177 | 
            +
                  version: '0'
         | 
| 178 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 179 | 
            +
              requirements:
         | 
| 180 | 
            +
              - - '>='
         | 
| 181 | 
            +
                - !ruby/object:Gem::Version
         | 
| 182 | 
            +
                  version: '0'
         | 
| 183 | 
            +
            requirements: []
         | 
| 184 | 
            +
            rubyforge_project: 
         | 
| 185 | 
            +
            rubygems_version: 2.1.10
         | 
| 186 | 
            +
            signing_key: 
         | 
| 187 | 
            +
            specification_version: 4
         | 
| 188 | 
            +
            summary: Quandl cassandra interface.
         | 
| 189 | 
            +
            test_files:
         | 
| 190 | 
            +
            - spec/expectations/string.rb
         | 
| 191 | 
            +
            - spec/expectations/time.rb
         | 
| 192 | 
            +
            - spec/factories/dataset.rb
         | 
| 193 | 
            +
            - spec/lib/quandl/cassandra/models/column/read_spec.rb
         | 
| 194 | 
            +
            - spec/lib/quandl/cassandra/models/column/write/group_data_by_frequency_spec.rb
         | 
| 195 | 
            +
            - spec/lib/quandl/cassandra/models/column/write_spec.rb
         | 
| 196 | 
            +
            - spec/lib/quandl/cassandra/models/column_attribute_spec.rb
         | 
| 197 | 
            +
            - spec/lib/quandl/cassandra/models/column_spec.rb
         | 
| 198 | 
            +
            - spec/lib/quandl/cassandra/models/data_spec.rb
         | 
| 199 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/collapse_spec.rb
         | 
| 200 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/column_spec.rb
         | 
| 201 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/persistence_spec.rb
         | 
| 202 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/row_spec.rb
         | 
| 203 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/transform_spec.rb
         | 
| 204 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/trim_spec.rb
         | 
| 205 | 
            +
            - spec/lib/quandl/cassandra/models/dataset/update_spec.rb
         | 
| 206 | 
            +
            - spec/lib/quandl/cassandra/models/dataset_attribute_spec.rb
         | 
| 207 | 
            +
            - spec/lib/quandl/cassandra/models/dataset_spec.rb
         | 
| 208 | 
            +
            - spec/lib/quandl/cassandra/models/multiset/collapse_spec.rb
         | 
| 209 | 
            +
            - spec/lib/quandl/cassandra/models/multiset/columns_spec.rb
         | 
| 210 | 
            +
            - spec/lib/quandl/cassandra/models/multiset/data_spec.rb
         | 
| 211 | 
            +
            - spec/lib/quandl/cassandra/models/multiset/transform_spec.rb
         | 
| 212 | 
            +
            - spec/spec_helper.rb
         |