active-record-streamer 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -22
- data/README.md +25 -1
- data/VERSION +1 -1
- data/active-record-streamer.gemspec +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d8b5c1fec28a6f974455ccce6fbd52a0fc12c50
|
4
|
+
data.tar.gz: 18f069f74884669921e18ba2de93e35bef73b4e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f58bb3295ba5ff75b6f60ae52fa962868cc14c55be11502a413b10ca5419c45863fe11426b50f1fa239676a62006c682dba4e2ef238c514917c56ab6f0942601
|
7
|
+
data.tar.gz: 237fc4af6c15458651d28d37418ba5aca3e9edc9e9bfde211e98a1908b13a89542c7c98dc51f9ca8dc856861871779194571b027a3ba2e94f6370aafc52ccec5
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -17,10 +17,10 @@ GEM
|
|
17
17
|
addressable (2.3.8)
|
18
18
|
arel (6.0.0)
|
19
19
|
array_enumerator (0.0.7)
|
20
|
-
baza (0.0.
|
20
|
+
baza (0.0.17)
|
21
21
|
array_enumerator (~> 0.0.7)
|
22
22
|
datet (~> 0.0.25)
|
23
|
-
|
23
|
+
event_handler (~> 0.0.0)
|
24
24
|
string-cases (~> 0.0.1)
|
25
25
|
wref (~> 0.0.8)
|
26
26
|
builder (3.2.2)
|
@@ -30,6 +30,7 @@ GEM
|
|
30
30
|
thread_safe (~> 0.3, >= 0.3.1)
|
31
31
|
diff-lcs (1.1.3)
|
32
32
|
docile (1.1.5)
|
33
|
+
event_handler (0.0.0)
|
33
34
|
faraday (0.9.1)
|
34
35
|
multipart-post (>= 1.2, < 3)
|
35
36
|
git (1.2.9.1)
|
@@ -43,8 +44,6 @@ GEM
|
|
43
44
|
oauth2
|
44
45
|
hashie (3.4.1)
|
45
46
|
highline (1.7.2)
|
46
|
-
http2 (0.0.31)
|
47
|
-
string-cases (~> 0)
|
48
47
|
i18n (0.7.0)
|
49
48
|
jeweler (2.0.1)
|
50
49
|
builder
|
@@ -57,13 +56,6 @@ GEM
|
|
57
56
|
rdoc
|
58
57
|
json (1.8.2)
|
59
58
|
jwt (1.5.0)
|
60
|
-
knjrbfw (0.0.113)
|
61
|
-
datet
|
62
|
-
http2
|
63
|
-
php4r
|
64
|
-
ruby_process
|
65
|
-
tsafe
|
66
|
-
wref (>= 0.0.8)
|
67
59
|
method_source (0.8.2)
|
68
60
|
mini_portile (0.6.2)
|
69
61
|
minitest (5.6.1)
|
@@ -79,10 +71,6 @@ GEM
|
|
79
71
|
multi_json (~> 1.3)
|
80
72
|
multi_xml (~> 0.5)
|
81
73
|
rack (~> 1.2)
|
82
|
-
php4r (0.0.4)
|
83
|
-
datet
|
84
|
-
http2
|
85
|
-
string-strtr
|
86
74
|
pry (0.10.1)
|
87
75
|
coderay (~> 1.1.0)
|
88
76
|
method_source (~> 0.8.1)
|
@@ -99,10 +87,6 @@ GEM
|
|
99
87
|
rspec-expectations (2.8.0)
|
100
88
|
diff-lcs (~> 1.1.2)
|
101
89
|
rspec-mocks (2.8.0)
|
102
|
-
ruby_process (0.0.13)
|
103
|
-
string-cases
|
104
|
-
tsafe
|
105
|
-
wref
|
106
90
|
simplecov (0.10.0)
|
107
91
|
docile (~> 1.1.0)
|
108
92
|
json (~> 1.8)
|
@@ -110,9 +94,7 @@ GEM
|
|
110
94
|
simplecov-html (0.10.0)
|
111
95
|
slop (3.6.0)
|
112
96
|
string-cases (0.0.1)
|
113
|
-
string-strtr (0.0.3)
|
114
97
|
thread_safe (0.3.5)
|
115
|
-
tsafe (0.0.11)
|
116
98
|
tzinfo (1.2.2)
|
117
99
|
thread_safe (~> 0.1)
|
118
100
|
wref (0.0.8)
|
@@ -122,7 +104,7 @@ PLATFORMS
|
|
122
104
|
|
123
105
|
DEPENDENCIES
|
124
106
|
activerecord (= 4.2.1)
|
125
|
-
baza (~> 0.0.
|
107
|
+
baza (~> 0.0.17)
|
126
108
|
bundler (~> 1.0)
|
127
109
|
jeweler (~> 2.0.1)
|
128
110
|
mysql2 (= 0.3.18)
|
data/README.md
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
# ActiveRecordStreamer
|
2
2
|
|
3
|
-
Stream ActiveRecord results.
|
3
|
+
Stream ActiveRecord results in a new database connection using an unbuffered query.
|
4
|
+
|
5
|
+
Great for huge queries with ordered results, where `find_each` is not an option.
|
6
|
+
|
7
|
+
ActiveRecordStreamer works through a single huge unbuffered query. For each 1000 models it preloads any includes and yields them back. It then loads another 1000 over and over until all rows has been read.
|
8
|
+
|
9
|
+
## Install
|
10
|
+
|
11
|
+
Add to your Gemfile and bundle:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'active_record_streamer'
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Use a normal query, pass it through ActiveRecordStreamer and loop over the results with `each`:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
users = User.where(something: 'something').includes(group: :users)
|
23
|
+
|
24
|
+
ActiveRecordStreamer.new(query: users).each |user|
|
25
|
+
puts "User: #{user.inspect}"
|
26
|
+
end
|
27
|
+
```
|
4
28
|
|
5
29
|
## Contributing to active-record-streamer
|
6
30
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: active-record-streamer 0.0.
|
5
|
+
# stub: active-record-streamer 0.0.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "active-record-streamer"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["kaspernj"]
|
14
|
-
s.date = "2015-05-
|
14
|
+
s.date = "2015-05-31"
|
15
15
|
s.description = "Stream ActiveRecord results"
|
16
16
|
s.email = "k@spernj.org"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
s.specification_version = 4
|
42
42
|
|
43
43
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
-
s.add_runtime_dependency(%q<baza>, ["~> 0.0.
|
44
|
+
s.add_runtime_dependency(%q<baza>, ["~> 0.0.17"])
|
45
45
|
s.add_development_dependency(%q<activerecord>, ["= 4.2.1"])
|
46
46
|
s.add_development_dependency(%q<mysql2>, ["= 0.3.18"])
|
47
47
|
s.add_development_dependency(%q<pry>, [">= 0"])
|
@@ -51,7 +51,7 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
52
52
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
53
53
|
else
|
54
|
-
s.add_dependency(%q<baza>, ["~> 0.0.
|
54
|
+
s.add_dependency(%q<baza>, ["~> 0.0.17"])
|
55
55
|
s.add_dependency(%q<activerecord>, ["= 4.2.1"])
|
56
56
|
s.add_dependency(%q<mysql2>, ["= 0.3.18"])
|
57
57
|
s.add_dependency(%q<pry>, [">= 0"])
|
@@ -62,7 +62,7 @@ Gem::Specification.new do |s|
|
|
62
62
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
63
63
|
end
|
64
64
|
else
|
65
|
-
s.add_dependency(%q<baza>, ["~> 0.0.
|
65
|
+
s.add_dependency(%q<baza>, ["~> 0.0.17"])
|
66
66
|
s.add_dependency(%q<activerecord>, ["= 4.2.1"])
|
67
67
|
s.add_dependency(%q<mysql2>, ["= 0.3.18"])
|
68
68
|
s.add_dependency(%q<pry>, [">= 0"])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-record-streamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: baza
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.17
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.17
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|