db_subsetter 0.4.0 → 0.4.1
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 +4 -4
- data/db_subsetter.gemspec +1 -1
- data/lib/db_subsetter/exporter.rb +5 -2
- data/lib/db_subsetter/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abf5990b7e3fd33ac74ba829e56919a5d6cc84c1
|
4
|
+
data.tar.gz: 3c83e352af29441d90675d8f1c924bdc80dfad14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb729b7e0db5e1de5133eaf082fb3e6067f4aaaa370b303a07c49d5a18bd3355f97a3a1ab43c3c41b508d470c9a126abac969d311c649fac9b0aa6bac23278e
|
7
|
+
data.tar.gz: f0637b18e81c8fb5414cac673b2f94d954bc8c10e1d7398ca8589c976069107ea22f5aff37d6aa7db7778f7173b76fc3056e6d3e0015931584c4f3d5d104ca0f
|
data/db_subsetter.gemspec
CHANGED
@@ -55,6 +55,7 @@ module DbSubsetter
|
|
55
55
|
|
56
56
|
def initialize
|
57
57
|
@scramblers = []
|
58
|
+
@page_counts = {}
|
58
59
|
end
|
59
60
|
|
60
61
|
private
|
@@ -88,7 +89,7 @@ module DbSubsetter
|
|
88
89
|
end
|
89
90
|
|
90
91
|
def pages(table)
|
91
|
-
( filtered_row_count(table) / select_batch_size.to_f ).ceil
|
92
|
+
@page_counts[table] ||= ( filtered_row_count(table) / select_batch_size.to_f ).ceil
|
92
93
|
end
|
93
94
|
|
94
95
|
def order_by(table)
|
@@ -134,7 +135,9 @@ module DbSubsetter
|
|
134
135
|
# Need to extend this to take more than the first batch_size records
|
135
136
|
query = query.order(arel_table[order_by(table)]) if order_by(table)
|
136
137
|
|
137
|
-
|
138
|
+
|
139
|
+
query = query.skip(i * select_batch_size).take(select_batch_size) if pages(table) > 1
|
140
|
+
sql = query.project( Arel.sql('*') ).to_sql
|
138
141
|
|
139
142
|
records = ActiveRecord::Base.connection.select_rows( sql )
|
140
143
|
records.each_slice(insert_batch_size) do |rows|
|
data/lib/db_subsetter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_subsetter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Francis
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: random-word
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.3'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.3'
|
97
97
|
description:
|
98
98
|
email:
|
99
99
|
- joe@lostapathy.com
|