forklift_etl 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +12 -12
- data/lib/forklift/patterns/mysql_patterns.rb +5 -1
- data/lib/forklift/transports/mysql.rb +5 -1
- data/lib/forklift/version.rb +1 -1
- data/spec/integration/mysql_spec.rb +31 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmIzZGJlZDAwZDhlNjE3ZjIxMzdkNGQ2ZDQ5NDk3ZTUzMzkxM2Y5MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzE3NzZjOGNiOWZiMDYxNDk4ZGIyZjRlNjdmOTk4NjU5MDYzNWZiZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTIxMmJiMWE5Nzg3ZTdiNDQyZGZjNDBhNzllNTg5ZTAyZDk0NTNmMGU1NzAy
|
10
|
+
ZjI4ZDY2NGM2ODkwNmViZGJjYTdmNzM0ZWFkMmM2MDFhNDUwY2ViMDJmODVk
|
11
|
+
Y2NmYmM5YmYwMDg1ZGM5NTNmMTk4MGNhYzg4ZWM2ZTA1M2IxZDY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTI1YWYxNzM4MDdlOWY1NTUyNzA4NTIwOWEwZWQwMjBkOGM0MGFkNzdiMGI4
|
14
|
+
YmI1YjhiNDY3NjkzYmNhYTdlYzg2ZWY4OGMyODUxYzk0ODU1NTM2OWQxY2Uw
|
15
|
+
NzE4MjNiZGY0YTNhMWU3OTg4ZDRhY2NhMTNhNzBjM2NhMTcyNDc=
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
forklift_etl (1.1.
|
4
|
+
forklift_etl (1.1.3)
|
5
5
|
activesupport (~> 4.0, >= 4.0.0)
|
6
6
|
elasticsearch (~> 1.0, >= 1.0.0)
|
7
7
|
lumberjack (~> 1.0, >= 1.0.0)
|
@@ -20,12 +20,12 @@ GEM
|
|
20
20
|
addressable (2.3.6)
|
21
21
|
awesome_print (1.2.0)
|
22
22
|
diff-lcs (1.2.5)
|
23
|
-
elasticsearch (1.0.
|
24
|
-
elasticsearch-api (= 1.0.
|
25
|
-
elasticsearch-transport (= 1.0.
|
26
|
-
elasticsearch-api (1.0.
|
23
|
+
elasticsearch (1.0.2)
|
24
|
+
elasticsearch-api (= 1.0.2)
|
25
|
+
elasticsearch-transport (= 1.0.2)
|
26
|
+
elasticsearch-api (1.0.2)
|
27
27
|
multi_json
|
28
|
-
elasticsearch-transport (1.0.
|
28
|
+
elasticsearch-transport (1.0.2)
|
29
29
|
faraday
|
30
30
|
multi_json
|
31
31
|
email_spec (1.5.0)
|
@@ -37,17 +37,17 @@ GEM
|
|
37
37
|
json (1.8.1)
|
38
38
|
launchy (2.4.2)
|
39
39
|
addressable (~> 2.3)
|
40
|
-
lumberjack (1.0.
|
40
|
+
lumberjack (1.0.7)
|
41
41
|
mail (2.5.4)
|
42
42
|
mime-types (~> 1.16)
|
43
43
|
treetop (~> 1.4.8)
|
44
44
|
mime-types (1.25.1)
|
45
|
-
minitest (5.3.
|
46
|
-
multi_json (1.10.
|
45
|
+
minitest (5.3.5)
|
46
|
+
multi_json (1.10.1)
|
47
47
|
multipart-post (2.0.0)
|
48
48
|
mysql2 (0.3.16)
|
49
49
|
polyglot (0.3.4)
|
50
|
-
pony (1.
|
50
|
+
pony (1.9)
|
51
51
|
mail (>= 2.0)
|
52
52
|
rake (10.2.2)
|
53
53
|
rspec (2.14.1)
|
@@ -58,11 +58,11 @@ GEM
|
|
58
58
|
rspec-expectations (2.14.5)
|
59
59
|
diff-lcs (>= 1.1.3, < 2.0)
|
60
60
|
rspec-mocks (2.14.6)
|
61
|
-
thread_safe (0.3.
|
61
|
+
thread_safe (0.3.4)
|
62
62
|
treetop (1.4.15)
|
63
63
|
polyglot
|
64
64
|
polyglot (>= 0.3.1)
|
65
|
-
tzinfo (1.1
|
65
|
+
tzinfo (1.2.1)
|
66
66
|
thread_safe (~> 0.1)
|
67
67
|
|
68
68
|
PLATFORMS
|
@@ -57,7 +57,11 @@ module Forklift
|
|
57
57
|
from_db = source.current_database
|
58
58
|
to_db = destination.current_database
|
59
59
|
if self.can_incremental_pipe?(source, from_table, destination, to_table, matcher)
|
60
|
-
|
60
|
+
begin
|
61
|
+
incremental_pipe(source, from_table, destination, to_table, matcher, primary_key)
|
62
|
+
rescue
|
63
|
+
pipe(source, from_table, destination, to_table)
|
64
|
+
end
|
61
65
|
else
|
62
66
|
pipe(source, from_table, destination, to_table)
|
63
67
|
end
|
@@ -82,10 +82,14 @@ module Forklift
|
|
82
82
|
keys = {}
|
83
83
|
data.each do |item|
|
84
84
|
item.each do |k,v|
|
85
|
-
keys[k] = sql_type(v) if ( keys[k].nil? )
|
85
|
+
keys[k] = sql_type(v) if ( keys[k].nil? && v.class != NilClass )
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
data.first do |k,v|
|
90
|
+
keys[k] = sql_type(v) if ( keys[k].nil? )
|
91
|
+
end
|
92
|
+
|
89
93
|
command = "CREATE TABLE `#{database}`.`#{table}` ( "
|
90
94
|
command << " `#{primary_key}` int(11) NOT NULL AUTO_INCREMENT, " if ( data.first[primary_key.to_sym].nil? )
|
91
95
|
keys.each do |col, type|
|
data/lib/forklift/version.rb
CHANGED
@@ -133,6 +133,37 @@ describe 'mysql' do
|
|
133
133
|
expect(cols).to eql ['id', 'thing', 'updated_at']
|
134
134
|
end
|
135
135
|
|
136
|
+
it "can will seek further for null-ish values" do
|
137
|
+
data = [
|
138
|
+
{id: 1, thing: 'stuff a', number: nil, updated_at: Time.new},
|
139
|
+
{id: 2, thing: 'stuff b', number: nil, updated_at: Time.new},
|
140
|
+
{id: 3, thing: 'stuff c', number: 100, updated_at: Time.new},
|
141
|
+
]
|
142
|
+
table = "new_table"
|
143
|
+
plan = SpecPlan.new
|
144
|
+
plan.do! {
|
145
|
+
destination = plan.connections[:mysql][:forklift_test_source_a]
|
146
|
+
destination.write(data, table)
|
147
|
+
}
|
148
|
+
|
149
|
+
destination = SpecClient.mysql('forklift_test_source_a')
|
150
|
+
cols = []
|
151
|
+
destination.query("describe #{table}").each do |row|
|
152
|
+
cols << row["Field"]
|
153
|
+
case row["Field"]
|
154
|
+
when "id"
|
155
|
+
expect(row["Type"]).to eql "bigint(20)"
|
156
|
+
when "thing"
|
157
|
+
expect(row["Type"]).to eql "text"
|
158
|
+
when "number"
|
159
|
+
expect(row["Type"]).to eql "bigint(20)"
|
160
|
+
when "updated_at"
|
161
|
+
expect(row["Type"]).to eql "datetime"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
expect(cols).to eql ['id', 'thing', 'updated_at', 'number']
|
165
|
+
end
|
166
|
+
|
136
167
|
end
|
137
168
|
|
138
169
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forklift_etl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Tahler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|