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: '0828c6c1f68719602e7da95022b0903b04ec26de2aef90b5a3ed965cdf4c803a'
4
- data.tar.gz: 015ce68daf808b52dd582d42e15774d5eb4f8d8ed788a407f6cdf6ceece8f9d5
3
+ metadata.gz: 2cf354ffae037a7f1896a4221b2f5d150a39c5711d775f30f47cb1348cf13322
4
+ data.tar.gz: 54a3787ed4ecbe17c9799a1c669aa7bec75dd1b8c8fc6e7cc68f0e273c3d18e9
5
5
  SHA512:
6
- metadata.gz: 8e6c4db4898719071ba940b0d0abc9784f4acb84937fb6ae0ae3c3de89f21fc112cb6593d8f5d3b85099b3f107c54084ff6e9b38509673dcf2fc49dcd69d374a
7
- data.tar.gz: 9d247bed23b59922a5bc2aa4f6c3e2e42fa22c8acb20dbee46cf8c3595fc4c4b3324916f281633b516dfba477d22ddc82684144c34f6b66a52d5810beff777a1
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", "~> 1.0.0"
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"
@@ -32,7 +32,6 @@ module Kiba::Plus::Destination
32
32
  drop_staging_table
33
33
  create_staging_table
34
34
  copy_to_staging_table
35
- #delete_before_insert
36
35
  merge_to_target_table
37
36
  drop_staging_table
38
37
  else
@@ -44,7 +44,6 @@ module Kiba::Plus::Destination
44
44
  @conn.put_copy_end
45
45
  @conn.get_last_result
46
46
  if incremental
47
- #delete_before_insert
48
47
  merge_to_target_table
49
48
  drop_staging_table
50
49
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Kiba
2
2
  module Plus
3
- VERSION = "0.2.2"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
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.2.2
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-22 00:00:00.000000000 Z
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: 1.0.0
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: 1.0.0
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement