kiba-plus 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/examples/customer_csv_to_mysql.etl +2 -0
- data/examples/customer_csv_to_pg.etl +2 -0
- data/examples/customer_mysql_to_csv.etl +3 -0
- data/examples/customer_mysql_to_pg.etl +3 -0
- data/examples/incremental_insert.etl +4 -0
- data/kiba-plus.gemspec +1 -1
- data/lib/kiba/plus/destination/csv.rb +1 -1
- data/lib/kiba/plus/destination/pg_bulk.rb +3 -3
- data/lib/kiba/plus/destination/pg_bulk2.rb +3 -3
- data/lib/kiba/plus/destination/pg_bulk_utils.rb +5 -5
- data/lib/kiba/plus/helper.rb +1 -1
- data/lib/kiba/plus/logger.rb +1 -1
- data/lib/kiba/plus/source/mysql.rb +1 -1
- data/lib/kiba/plus/version.rb +1 -1
- data/lib/kiba/plus.rb +1 -1
- 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: bbe35735f2f3a6127a9ab2c5d95729f9a7e5a6fa
|
4
|
+
data.tar.gz: 8d975f78c52c8e3b0515c7403aeeddcd61d63c50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4065afb5ecf4fc54aba299173dad3fc628f365bd273eab056178e04bfeb618b446dfa4203e0ca7fb73864c3ea1a0ff32a3bf2e88a4e1a392bef732020a2bd1f
|
7
|
+
data.tar.gz: 879cede2ab9990971ed4a263a61365cff64a99838cc0c42fc58abecf83640b791c88973c6f1aad6821938ebe96e3adfbb223d2a3efc4aaa0ea02a3e2db74a8e0
|
data/README.md
CHANGED
@@ -8,6 +8,9 @@ Kiba enhancement for Ruby ETL. It connects to various data sources including rel
|
|
8
8
|
|
9
9
|
require 'kiba/plus'
|
10
10
|
|
11
|
+
require 'kiba/plus/source/mysql'
|
12
|
+
require 'kiba/plus/destination/pg_bulk2'
|
13
|
+
|
11
14
|
SOURCE_URL = 'mysql://root@localhost/shopperplus'
|
12
15
|
|
13
16
|
DEST_URL = 'postgresql://hooopo@localhost:5432/crm2_dev'
|
@@ -120,4 +123,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
120
123
|
|
121
124
|
## Contributing
|
122
125
|
|
123
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
126
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/hooopo/kiba-plus.
|
@@ -1,6 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require_relative 'init'
|
3
3
|
|
4
|
+
require 'kiba/plus/job'
|
5
|
+
require 'kiba/plus/source/mysql'
|
6
|
+
require 'kiba/plus/destination/pg_bulk2'
|
7
|
+
|
4
8
|
SOURCE_URL = 'mysql://root@localhost/shopperplus'
|
5
9
|
|
6
10
|
DEST_URL = 'postgresql://hooopo@localhost:5432/crm2_dev'
|
data/kiba-plus.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.add_runtime_dependency "kiba", "~> 0.
|
30
|
+
spec.add_runtime_dependency "kiba", "~> 1.0.0"
|
31
31
|
|
32
32
|
spec.add_development_dependency "bundler", "~> 1.11"
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -29,12 +29,12 @@ module Kiba::Plus::Destination
|
|
29
29
|
|
30
30
|
def close
|
31
31
|
if incremental
|
32
|
-
|
32
|
+
drop_staging_table
|
33
33
|
create_staging_table
|
34
34
|
copy_to_staging_table
|
35
35
|
delete_before_insert
|
36
36
|
merge_to_target_table
|
37
|
-
|
37
|
+
drop_staging_table
|
38
38
|
else
|
39
39
|
copy_to_target_table
|
40
40
|
end
|
@@ -46,7 +46,7 @@ module Kiba::Plus::Destination
|
|
46
46
|
|
47
47
|
def init
|
48
48
|
if truncate
|
49
|
-
|
49
|
+
drop_staging_table
|
50
50
|
truncate_target_table
|
51
51
|
end
|
52
52
|
end
|
@@ -46,7 +46,7 @@ module Kiba::Plus::Destination
|
|
46
46
|
if incremental
|
47
47
|
delete_before_insert
|
48
48
|
merge_to_target_table
|
49
|
-
|
49
|
+
drop_staging_table
|
50
50
|
end
|
51
51
|
rescue
|
52
52
|
raise
|
@@ -59,11 +59,11 @@ module Kiba::Plus::Destination
|
|
59
59
|
|
60
60
|
def init
|
61
61
|
if truncate
|
62
|
-
|
62
|
+
drop_staging_table
|
63
63
|
truncate_target_table
|
64
64
|
end
|
65
65
|
if incremental
|
66
|
-
|
66
|
+
drop_staging_table
|
67
67
|
create_staging_table
|
68
68
|
sql = bulk_sql_with_incremental
|
69
69
|
else
|
@@ -22,14 +22,14 @@ module Kiba::Plus::Destination
|
|
22
22
|
format_sql sql
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
sql =
|
25
|
+
def drop_staging_table
|
26
|
+
sql = drop_staging_table_sql
|
27
27
|
Kiba::Plus.logger.info sql
|
28
28
|
@conn.exec(sql) rescue nil
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
sql = "
|
31
|
+
def drop_staging_table_sql
|
32
|
+
sql = "DROP TABLE IF EXISTS #{staging_table_name}"
|
33
33
|
format_sql sql
|
34
34
|
end
|
35
35
|
|
@@ -69,4 +69,4 @@ module Kiba::Plus::Destination
|
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
72
|
-
end
|
72
|
+
end
|
data/lib/kiba/plus/helper.rb
CHANGED
data/lib/kiba/plus/logger.rb
CHANGED
@@ -22,7 +22,7 @@ module Kiba
|
|
22
22
|
|
23
23
|
def each
|
24
24
|
Kiba::Plus.logger.info query
|
25
|
-
results = client.query(query, as: :hash, symbolize_keys: true, stream: true)
|
25
|
+
results = client.query(query, as: :hash, symbolize_keys: true, stream: true, cache_rows: false)
|
26
26
|
results.each do |row|
|
27
27
|
yield(row)
|
28
28
|
end
|
data/lib/kiba/plus/version.rb
CHANGED
data/lib/kiba/plus.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kiba-plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hooopo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kiba
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.0.0
|
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:
|
26
|
+
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|