cequel 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d14904f7678b99fb9228f1d0e255ece706ac607f
4
- data.tar.gz: 9f63a0b4abf6d672c9712d7e5eebe34aae777212
3
+ metadata.gz: 533e3980f9450dfeafb79127893006ba81fb3b64
4
+ data.tar.gz: 534f0031b6098578ae6fa1a12668dcf537cca564
5
5
  SHA512:
6
- metadata.gz: bbad8d78bc4b5752cd0a708948c6f95fa0145679a3d8748ca16084e15b11b6c820817a244083d357799fc05c44c188dfe5703b22527ab1c3de5e36522418eb5c
7
- data.tar.gz: c0eaaa9c567b14710dbd73bf58c6fe8ff27bec66b99545a362017206839c5f88c4de146500b50c97fc3c776041534fb1517107bed4e43d69472b7fb3d1ba82ac
6
+ metadata.gz: bba81999115ee78bd0980340d331f20794aa7aece07cedce42bcd235c6d0a6cfd2e58a67c7a37ccc157972a59de12a1a03918556871740deaa3f452e05728198
7
+ data.tar.gz: 697022e12729db4a4bbeca38f9569d4452d196b003feb59db93d843f80bebbd672ddc2ffc262dfe263238b3f78776e7d59a1ac7ec4e27531aab38ef6f4a53185
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.8.0
2
+
3
+ * remove false claims of Rubinius support from readme (we would gratefully accept a PR to fix compatibility)
4
+ * add dirty tracking on unsaved records
5
+ * fix key column order bug on tables with more than 2 key columns
6
+ * trim very large field values to a reasonable size in log messages
7
+ * native CQL paging support
8
+
1
9
  ## 1.7.0
2
10
 
3
11
  * Support Cassandra up to 2.2
data/Gemfile.lock CHANGED
@@ -1,54 +1,51 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cequel (1.7.0)
4
+ cequel (1.8.0)
5
5
  activemodel (~> 4.0)
6
6
  cassandra-driver (~> 2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (4.2.4)
12
- activesupport (= 4.2.4)
11
+ activemodel (4.2.5.1)
12
+ activesupport (= 4.2.5.1)
13
13
  builder (~> 3.1)
14
- activesupport (4.2.4)
14
+ activesupport (4.2.5.1)
15
15
  i18n (~> 0.7)
16
16
  json (~> 1.7, >= 1.7.7)
17
17
  minitest (~> 5.1)
18
18
  thread_safe (~> 0.3, >= 0.3.4)
19
19
  tzinfo (~> 1.1)
20
- addressable (2.3.7)
21
- appraisal (1.0.2)
20
+ addressable (2.4.0)
21
+ appraisal (1.0.3)
22
22
  bundler
23
23
  rake
24
24
  thor (>= 0.14.0)
25
25
  ast (2.0.0)
26
- astrolabe (1.3.0)
27
- parser (>= 2.2.0.pre.3, < 3.0)
28
- backports (3.6.4)
26
+ backports (3.6.8)
29
27
  builder (3.2.2)
30
28
  byebug (2.7.0)
31
29
  columnize (~> 0.3)
32
30
  debugger-linecache (~> 1.2)
33
- cassandra-driver (2.1.4)
31
+ cassandra-driver (2.1.5)
34
32
  ione (~> 1.2)
35
33
  coderay (1.1.0)
36
- columnize (0.9.0)
34
+ columnize (0.8.9)
37
35
  debugger (1.6.8)
38
36
  columnize (>= 0.3.1)
39
37
  debugger-linecache (~> 1.2.0)
40
38
  debugger-ruby_core_source (~> 1.3.5)
41
39
  debugger-linecache (1.2.0)
42
- debugger-ruby_core_source (1.3.8)
40
+ debugger-ruby_core_source (1.3.5)
43
41
  diff-lcs (1.2.5)
44
- ethon (0.7.2)
42
+ ethon (0.8.1)
45
43
  ffi (>= 1.3.0)
46
- faraday (0.9.1)
44
+ faraday (0.9.2)
47
45
  multipart-post (>= 1.2, < 3)
48
- faraday_middleware (0.9.1)
46
+ faraday_middleware (0.10.0)
49
47
  faraday (>= 0.7.4, < 0.10)
50
- ffi (1.9.6)
51
- ffi (1.9.6-java)
48
+ ffi (1.9.10)
52
49
  ffi2-generators (0.1.1)
53
50
  gh (0.14.0)
54
51
  addressable
@@ -57,64 +54,57 @@ GEM
57
54
  multi_json (~> 1.0)
58
55
  net-http-persistent (>= 2.7)
59
56
  net-http-pipeline
60
- highline (1.6.21)
57
+ highline (1.7.8)
61
58
  i18n (0.7.0)
62
- ione (1.2.1)
63
- json (1.8.2)
64
- json (1.8.2-java)
59
+ ione (1.2.3)
60
+ json (1.8.3)
65
61
  launchy (2.4.3)
66
62
  addressable (~> 2.3)
67
- launchy (2.4.3-java)
68
- addressable (~> 2.3)
69
- spoon (~> 0.0.1)
70
63
  method_source (0.8.2)
71
- minitest (5.8.0)
72
- multi_json (1.10.1)
64
+ minitest (5.8.4)
65
+ multi_json (1.11.2)
73
66
  multipart-post (2.0.0)
74
67
  net-http-persistent (2.9.4)
75
68
  net-http-pipeline (1.0.1)
76
- parser (2.2.0.3)
69
+ parser (2.1.9)
77
70
  ast (>= 1.1, < 3.0)
78
- powerpack (0.1.0)
79
- pry (0.9.12.6)
80
- coderay (~> 1.0)
81
- method_source (~> 0.8)
82
- slop (~> 3.4)
83
- pry (0.9.12.6-java)
84
- coderay (~> 1.0)
85
- method_source (~> 0.8)
71
+ slop (~> 3.4, >= 3.4.5)
72
+ powerpack (0.0.9)
73
+ pry (0.10.1)
74
+ coderay (~> 1.1.0)
75
+ method_source (~> 0.8.1)
86
76
  slop (~> 3.4)
87
- spoon (~> 0.0)
88
- psych (2.0.12)
89
- pusher-client (0.6.0)
77
+ psych (2.0.6)
78
+ pusher-client (0.6.2)
90
79
  json
91
80
  websocket (~> 1.0)
92
81
  racc (1.4.12)
93
82
  rainbow (2.0.0)
94
- rake (10.4.2)
95
- rspec (3.2.0)
96
- rspec-core (~> 3.2.0)
97
- rspec-expectations (~> 3.2.0)
98
- rspec-mocks (~> 3.2.0)
99
- rspec-core (3.2.0)
100
- rspec-support (~> 3.2.0)
101
- rspec-expectations (3.2.0)
83
+ rake (10.3.2)
84
+ rb-readline (0.5.1)
85
+ rspec (3.4.0)
86
+ rspec-core (~> 3.4.0)
87
+ rspec-expectations (~> 3.4.0)
88
+ rspec-mocks (~> 3.4.0)
89
+ rspec-core (3.4.3)
90
+ rspec-support (~> 3.4.0)
91
+ rspec-expectations (3.4.0)
102
92
  diff-lcs (>= 1.2.0, < 2.0)
103
- rspec-support (~> 3.2.0)
104
- rspec-its (1.1.0)
93
+ rspec-support (~> 3.4.0)
94
+ rspec-its (1.2.0)
105
95
  rspec-core (>= 3.0.0)
106
96
  rspec-expectations (>= 3.0.0)
107
- rspec-mocks (3.2.0)
97
+ rspec-mocks (3.4.1)
108
98
  diff-lcs (>= 1.2.0, < 2.0)
109
- rspec-support (~> 3.2.0)
110
- rspec-support (3.2.1)
111
- rubocop (0.29.1)
112
- astrolabe (~> 1.3)
113
- parser (>= 2.2.0.1, < 3.0)
114
- powerpack (~> 0.1)
99
+ rspec-support (~> 3.4.0)
100
+ rspec-support (3.4.1)
101
+ rubocop (0.19.1)
102
+ json (>= 1.7.7, < 2)
103
+ parser (~> 2.1.7)
104
+ powerpack (~> 0.0.6)
115
105
  rainbow (>= 1.99.1, < 3.0)
116
106
  ruby-progressbar (~> 1.4)
117
- ruby-progressbar (1.7.1)
107
+ ruby-progressbar (1.6.0)
118
108
  rubysl (2.1.0)
119
109
  rubysl-abbrev (~> 2.0)
120
110
  rubysl-base64 (~> 2.0)
@@ -219,14 +209,14 @@ GEM
219
209
  rubysl-csv (2.0.2)
220
210
  rubysl-english (~> 2.0)
221
211
  rubysl-curses (2.0.1)
222
- rubysl-date (2.0.9)
212
+ rubysl-date (2.0.8)
223
213
  rubysl-delegate (2.0.1)
224
214
  rubysl-digest (2.0.3)
225
215
  rubysl-drb (2.0.1)
226
216
  rubysl-e2mmap (2.0.0)
227
217
  rubysl-english (2.0.0)
228
218
  rubysl-enumerator (2.0.0)
229
- rubysl-erb (2.0.2)
219
+ rubysl-erb (2.0.1)
230
220
  rubysl-etc (2.0.3)
231
221
  ffi2-generators (~> 0.1)
232
222
  rubysl-expect (2.0.0)
@@ -244,11 +234,12 @@ GEM
244
234
  rubysl-io-nonblock (2.0.0)
245
235
  rubysl-io-wait (2.0.0)
246
236
  rubysl-ipaddr (2.0.0)
247
- rubysl-irb (2.1.1)
237
+ rubysl-irb (2.1.0)
238
+ rb-readline (~> 0.5)
248
239
  rubysl-e2mmap (~> 2.0)
249
240
  rubysl-mathn (~> 2.0)
250
241
  rubysl-thread (~> 2.0)
251
- rubysl-logger (2.1.0)
242
+ rubysl-logger (2.0.0)
252
243
  rubysl-mathn (2.0.0)
253
244
  rubysl-matrix (2.1.0)
254
245
  rubysl-e2mmap (~> 2.0)
@@ -271,7 +262,7 @@ GEM
271
262
  rubysl-observer (2.0.0)
272
263
  rubysl-open-uri (2.0.0)
273
264
  rubysl-open3 (2.0.0)
274
- rubysl-openssl (2.2.1)
265
+ rubysl-openssl (2.2.0)
275
266
  rubysl-optparse (2.0.1)
276
267
  rubysl-shellwords (~> 2.0)
277
268
  rubysl-ostruct (2.0.4)
@@ -281,10 +272,10 @@ GEM
281
272
  rubysl-profile (2.0.0)
282
273
  rubysl-profiler (2.0.1)
283
274
  rubysl-pstore (2.0.0)
284
- rubysl-pty (2.0.3)
275
+ rubysl-pty (2.0.2)
285
276
  rubysl-rational (2.0.1)
286
277
  rubysl-resolv (2.1.0)
287
- rubysl-rexml (2.0.4)
278
+ rubysl-rexml (2.0.2)
288
279
  rubysl-rinda (2.0.1)
289
280
  rubysl-rss (2.0.0)
290
281
  rubysl-scanf (2.0.0)
@@ -296,7 +287,7 @@ GEM
296
287
  rubysl-stringio (2.0.0)
297
288
  rubysl-strscan (2.0.0)
298
289
  rubysl-sync (2.0.0)
299
- rubysl-syslog (2.1.0)
290
+ rubysl-syslog (2.0.1)
300
291
  ffi2-generators (~> 0.1)
301
292
  rubysl-tempfile (2.0.1)
302
293
  rubysl-thread (2.0.2)
@@ -312,35 +303,30 @@ GEM
312
303
  rubysl-weakref (2.0.0)
313
304
  rubysl-webrick (2.0.0)
314
305
  rubysl-xmlrpc (2.0.0)
315
- rubysl-yaml (2.1.0)
306
+ rubysl-yaml (2.0.4)
316
307
  rubysl-zlib (2.0.1)
317
308
  slop (3.6.0)
318
- spoon (0.0.4)
319
- ffi
320
309
  thor (0.19.1)
321
310
  thread_safe (0.3.5)
322
311
  timecop (0.7.1)
323
- travis (1.7.5)
324
- addressable (~> 2.3)
312
+ travis (1.8.2)
325
313
  backports
326
314
  faraday (~> 0.9)
327
315
  faraday_middleware (~> 0.9, >= 0.9.1)
328
316
  gh (~> 0.13)
329
317
  highline (~> 1.6)
330
318
  launchy (~> 2.1)
331
- pry (~> 0.9, < 0.10)
332
319
  pusher-client (~> 0.4)
333
320
  typhoeus (~> 0.6, >= 0.6.8)
334
- typhoeus (0.7.1)
335
- ethon (>= 0.7.1)
321
+ typhoeus (0.8.0)
322
+ ethon (>= 0.8.0)
336
323
  tzinfo (1.2.2)
337
324
  thread_safe (~> 0.1)
338
- websocket (1.2.1)
339
- wwtd (0.7.0)
325
+ websocket (1.2.2)
326
+ wwtd (0.9.1)
340
327
  yard (0.8.7.6)
341
328
 
342
329
  PLATFORMS
343
- java
344
330
  ruby
345
331
 
346
332
  DEPENDENCIES
@@ -360,3 +346,6 @@ DEPENDENCIES
360
346
  travis (~> 1.7)
361
347
  wwtd (~> 0.5)
362
348
  yard (~> 0.6)
349
+
350
+ BUNDLED WITH
351
+ 1.11.2
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Cequel #
2
2
 
3
3
  Cequel is a Ruby ORM for [Cassandra](http://cassandra.apache.org/) using
4
- [CQL3](http://www.datastax.com/documentation/cql/3.0/webhelp/index.html).
4
+ [CQL3][].
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/cequel.png)](http://badge.fury.io/rb/cequel)
7
7
  [![Build Status](https://travis-ci.org/cequel/cequel.png?branch=master)](https://travis-ci.org/cequel/cequel)
@@ -28,7 +28,7 @@ gem 'cequel'
28
28
 
29
29
  Cequel does not require Rails, but if you are using Rails, you
30
30
  will need version 3.2+. Cequel::Record will read from the configuration file
31
- `config/cequel.yml` if it is present. You can generate a default configuarion
31
+ `config/cequel.yml` if it is present. You can generate a default configuration
32
32
  file with:
33
33
 
34
34
  ```bash
@@ -115,6 +115,33 @@ class PostsController < ActionController::Base
115
115
  end
116
116
  ```
117
117
 
118
+ Parent child relationship in a namespaced model can be defined using the `class_name` option of `belongs_to` method as follows:
119
+
120
+ ```ruby
121
+ module Blogger
122
+ class Blog
123
+ include Cequel::Record
124
+
125
+ key :subdomain, :text
126
+ column :name, :text
127
+ column :description, :text
128
+
129
+ has_many :posts
130
+ end
131
+ end
132
+
133
+ module Blogger
134
+ class Post
135
+ include Cequel::Record
136
+
137
+ belongs_to :blog, class_name: 'Blogger::Blog'
138
+ key :id, :timeuuid, auto: true
139
+ column :title, :text
140
+ column :body, :text
141
+ end
142
+ end
143
+ ```
144
+
118
145
  ### Timestamps ###
119
146
 
120
147
  If your final primary key column is a `timeuuid` with the `:auto` option set,
@@ -519,9 +546,8 @@ the columns that are given.
519
546
 
520
547
  ### Ruby ###
521
548
 
522
- * Ruby 2.2, 2.1, 2.0
549
+ * Ruby 2.3, 2.2, 2.1, 2.0
523
550
  * JRuby 1.7, 9.0
524
- * Rubinius 2.5
525
551
 
526
552
  ### Cassandra ###
527
553
 
@@ -587,3 +613,5 @@ the maintainer of Cequel.
587
613
 
588
614
  Cequel is distributed under the MIT license. See the attached LICENSE for all
589
615
  the sordid details.
616
+
617
+ [CQL3]: http://docs.datastax.com/en/cql/3.3/cql/cqlIntro.html
data/Rakefile CHANGED
@@ -1,7 +1,8 @@
1
+ require 'rubocop'
2
+ require 'rubocop/rake_task'
1
3
  require 'yaml'
2
4
  require 'bundler/setup'
3
5
  require 'rspec/core/rake_task'
4
- require 'rubocop/rake_task'
5
6
  require 'wwtd/tasks'
6
7
  require 'travis'
7
8
  require File.expand_path('../lib/cequel/version', __FILE__)
@@ -62,12 +63,12 @@ RSpec::Core::RakeTask.new(:test) do |t|
62
63
  t.rspec_opts = rspec_opts
63
64
  end
64
65
 
65
- desc 'Check style with Rubocop'
66
- RuboCop::RakeTask.new(:rubocop) do |task|
67
- task.patterns = ['lib/**/*.rb']
68
- task.formatters = ['files']
69
- task.fail_on_error = true
70
- end
66
+ # desc 'Check style with Rubocop'
67
+ # RuboCop::RakeTask.new(:rubocop) do |task|
68
+ # task.patterns = ['lib/**/*.rb']
69
+ # task.formatters = ['files']
70
+ # task.fail_on_error = true
71
+ # end
71
72
 
72
73
  namespace :test do
73
74
  desc 'Run the specs with progress formatter'
@@ -48,6 +48,8 @@ module Cequel
48
48
  # use
49
49
  # @since 1.1.0
50
50
  attr_reader :query_consistency
51
+ attr_reader :query_page_size
52
+ attr_reader :query_paging_state
51
53
 
52
54
  def_delegator :keyspace, :write_with_consistency
53
55
 
@@ -565,6 +567,22 @@ module Cequel
565
567
  end
566
568
  end
567
569
 
570
+ def page_size(page_size)
571
+ clone.tap do |data_set|
572
+ data_set.query_page_size = page_size
573
+ end
574
+ end
575
+
576
+ def paging_state(paging_state)
577
+ clone.tap do |data_set|
578
+ data_set.query_paging_state = paging_state
579
+ end
580
+ end
581
+
582
+ def next_paging_state
583
+ results.paging_state
584
+ end
585
+
568
586
  # rubocop:enable LineLength
569
587
 
570
588
  #
@@ -582,8 +600,7 @@ module Cequel
582
600
  #
583
601
  def each
584
602
  return enum_for(:each) unless block_given?
585
- result = execute_cql(*cql)
586
- result.each { |row| yield Row.from_result_row(row) }
603
+ results.each { |row| yield Row.from_result_row(row) }
587
604
  end
588
605
 
589
606
  #
@@ -655,12 +672,20 @@ module Cequel
655
672
 
656
673
  protected
657
674
 
658
- attr_writer :row_limit, :query_consistency
675
+ attr_writer :row_limit, :query_consistency, :query_page_size, :query_paging_state
659
676
 
660
677
  private
661
678
 
679
+ def results
680
+ @results ||= execute_cql(*cql)
681
+ end
682
+
662
683
  def execute_cql(cql, *bind_vars)
663
- keyspace.execute_with_consistency(cql, bind_vars, query_consistency)
684
+ keyspace.execute_with_options(cql, bind_vars, {
685
+ consistency: query_consistency,
686
+ page_size: query_page_size,
687
+ paging_state: query_paging_state
688
+ })
664
689
  end
665
690
 
666
691
  def inserter(&block)