kiba-plus 0.2.2 → 1.0.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cf354ffae037a7f1896a4221b2f5d150a39c5711d775f30f47cb1348cf13322
|
4
|
+
data.tar.gz: 54a3787ed4ecbe17c9799a1c669aa7bec75dd1b8c8fc6e7cc68f0e273c3d18e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97535e0b00949251877e23bd1e34c093917697b224794dd3fb118a631b109b4ed9fbc1cc146eda020e5974a27a325e3b36ebad247d2977c49bb0645cdbcd6124
|
7
|
+
data.tar.gz: bf5bc5977edf10480269edf0623acae8b34d25c5deb3630d2e8caed01a96a48bbdfa172a1be87e9b028bc7421a8db8323201f67e1dad961263f471544e8db705
|
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", "~>
|
30
|
+
spec.add_runtime_dependency "kiba", "~> 2.0.0"
|
31
31
|
|
32
32
|
spec.add_development_dependency "bundler"
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -44,20 +44,6 @@ module Kiba::Plus::Destination
|
|
44
44
|
format_sql sql
|
45
45
|
end
|
46
46
|
|
47
|
-
# TODO remove it
|
48
|
-
def delete_before_insert
|
49
|
-
sql = delete_before_insert_sql
|
50
|
-
Kiba::Plus.logger.info sql
|
51
|
-
@conn.exec(sql)
|
52
|
-
end
|
53
|
-
|
54
|
-
# TODO remove it
|
55
|
-
def delete_before_insert_sql
|
56
|
-
where = Array(unique_by).map{|x| ["#{staging_table_name}.#{x}", "#{table_name}.#{x}"].join(" = ") }.join(" AND ")
|
57
|
-
sql = "DELETE FROM #{table_name} USING #{staging_table_name} WHERE #{where}"
|
58
|
-
format_sql sql
|
59
|
-
end
|
60
|
-
|
61
47
|
def merge_to_target_table
|
62
48
|
sql = merge_to_target_table_sql
|
63
49
|
Kiba::Plus.logger.info sql
|
@@ -68,7 +54,7 @@ module Kiba::Plus::Destination
|
|
68
54
|
sets = columns.map{|x| "#{x} = excluded.#{x}" }.join(', ')
|
69
55
|
sql = <<~SQL
|
70
56
|
INSERT INTO #{table_name} (SELECT * FROM #{staging_table_name})
|
71
|
-
ON CONFLICT (#{unique_by.join(", ")})
|
57
|
+
ON CONFLICT (#{Array(unique_by).join(", ")})
|
72
58
|
DO UPDATE SET #{sets}
|
73
59
|
SQL
|
74
60
|
format_sql sql
|
data/lib/kiba/plus/version.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.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hooopo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08
|
11
|
+
date: 2019-11-08 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: 2.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: 2.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|