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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2c182fb620f80bbd0703399075d2aafd870e65b
4
- data.tar.gz: cee85bda9ae9987d1d934ddc027cb9f2bd4e4c47
3
+ metadata.gz: bbe35735f2f3a6127a9ab2c5d95729f9a7e5a6fa
4
+ data.tar.gz: 8d975f78c52c8e3b0515c7403aeeddcd61d63c50
5
5
  SHA512:
6
- metadata.gz: 7c84b2095c49737f7d69eba1880a83b1bc8185acb070fcb58491d7c35633591d258c2373fef4de1179964c47e57fe1a380affb01e5eca3cbcba76009fd298bf7
7
- data.tar.gz: 8c76f6b6264e4024c2c72ca582ef496756a2683765012a252b9e7df7dbae9d4db4abd08b06d2f0f2555a7f0010304f5d2d8d96bcdb4d4960ea34f567e9488984
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/[USERNAME]/kiba-plus.
126
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hooopo/kiba-plus.
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative 'init'
3
3
 
4
+ require 'kiba/plus/destination/mysql_bulk'
5
+
4
6
  DEST_URL = 'mysql://root@localhost/crm2_dev'
5
7
 
6
8
  destination Kiba::Plus::Destination::MysqlBulk, { :connect_url => DEST_URL,
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative 'init'
3
3
 
4
+ require 'kiba/plus/destination/pg_bulk'
5
+
4
6
  DEST_URL = 'postgresql://hooopo@localhost:5432/crm2_dev'
5
7
 
6
8
  destination Kiba::Plus::Destination::PgBulk, { :connect_url => DEST_URL,
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative 'init'
3
3
 
4
+ require 'kiba/plus/source/mysql'
5
+ require 'kiba/plus/destination/csv'
6
+
4
7
  SOURCE_URL = 'mysql://root@localhost/shopperplus'
5
8
 
6
9
  source Kiba::Plus::Source::Mysql, :connect_url => SOURCE_URL,
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative 'init'
3
3
 
4
+ require 'kiba/plus/source/mysql'
5
+ require 'kiba/plus/destination/pg_bulk2'
6
+
4
7
  SOURCE_URL = 'mysql://root@localhost/shopperplus'
5
8
 
6
9
  DEST_URL = 'postgresql://hooopo@localhost:5432/crm2_dev'
@@ -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.6"
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"
@@ -57,4 +57,4 @@ module Kiba::Plus::Destination
57
57
  end
58
58
 
59
59
  end
60
- end
60
+ end
@@ -29,12 +29,12 @@ module Kiba::Plus::Destination
29
29
 
30
30
  def close
31
31
  if incremental
32
- truncate_staging_table
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
- truncate_staging_table
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
- truncate_staging_table
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
- truncate_staging_table
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
- truncate_staging_table
62
+ drop_staging_table
63
63
  truncate_target_table
64
64
  end
65
65
  if incremental
66
- truncate_staging_table
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 truncate_staging_table
26
- sql = truncate_staging_table_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 truncate_staging_table_sql
32
- sql = "TRUNCATE TABLE #{staging_table_name}"
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
@@ -26,4 +26,4 @@ module Kiba
26
26
 
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -9,4 +9,4 @@ module Kiba
9
9
  @logger = logger
10
10
  end
11
11
  end
12
- end
12
+ end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Kiba
2
2
  module Plus
3
- VERSION = "0.1.12"
3
+ VERSION = "0.1.13"
4
4
  end
5
5
  end
data/lib/kiba/plus.rb CHANGED
@@ -17,4 +17,4 @@ class Hash
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ 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.1.12
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-14 00:00:00.000000000 Z
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: '0.6'
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: '0.6'
26
+ version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement