redshifter 0.6.0 → 0.6.1

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: 9f5f06faed21081d4041a36d24b07891aa5dd5dc
4
- data.tar.gz: 5b6d57bdf2a5a22a30a33af0455b97095d2006e4
3
+ metadata.gz: c151f3b6b5deb6045873d8a6cad78750678daf42
4
+ data.tar.gz: c109238dbc076bcb27076698c463ac5f21134fdc
5
5
  SHA512:
6
- metadata.gz: b27b23941087fd98d1096d26f632757aab46425467885c39b5f11cab69601ca3a2dde796a4a6129b163cac409fcf40b27f8e1bbebc1f33961bf4f46e46b82b60
7
- data.tar.gz: 614fe6a514775a18b723478e16adfadb48f9ea0dece1730a842a5579c8a770024418a7c9456dca3a7f677d3f0768ca9eae3b220a422dd2b8c55d98a8c7e6e54a
6
+ metadata.gz: 6c43734276fe0cd4229713ae6f97d8aa8a824d4472e7f076c2a71ad5ad37ab19d10923c3ecc5d1d71ddcf32fa02964e860d223d5b9e32d8dbcf25a106186c577
7
+ data.tar.gz: bc7974e4cc1a02d2593fc7ba3647489484a8bbd2834584230b07d1822a6cf85ba70515d66ac0d95fcc43b9aa3f650610d24fd108f7420572fd086eea8422c20e
data/README.md CHANGED
@@ -19,6 +19,7 @@ Feature Roadmap:
19
19
  - 0.5.0 - Add functionality for source_table_filter to selectively export rows
20
20
  - 0.5.1 - Fix bug where there was an erroneous default value for source_table_filter
21
21
  - 0.6.0 - Add ReplaceRedshiftTableJob
22
+ - 0.6.1 - Introduce logger config option
22
23
 
23
24
  ## Installation
24
25
 
@@ -62,6 +63,7 @@ Redshifter.setup do |config|
62
63
  # start new dynos
63
64
  config.heroku_api_key = '<Heroku user api key>'
64
65
  config.heroku_app_name = 'name of the app on heroku'
66
+ config.logger = Rails.logger
65
67
  end
66
68
  ```
67
69
 
@@ -4,6 +4,7 @@ module Redshifter
4
4
  yield config if block_given?
5
5
  load_export_table_definitions
6
6
  config_dynosaur
7
+ setup_default_logger
7
8
  end
8
9
 
9
10
  def config
@@ -21,7 +22,8 @@ module Redshifter
21
22
  :heroku_api_key,
22
23
  :heroku_app_name,
23
24
  :temp_directory_path,
24
- :table_config_path).new
25
+ :table_config_path,
26
+ :logger).new
25
27
  end
26
28
 
27
29
  private
@@ -38,5 +40,11 @@ module Redshifter
38
40
  config.app_name = Redshifter.config.heroku_app_name
39
41
  end
40
42
  end
43
+
44
+ def setup_default_logger
45
+ require 'logger'
46
+ config.logger = Logger.new(STDOUT)
47
+ end
48
+
41
49
  end
42
50
  end
@@ -6,24 +6,31 @@ module Redshifter
6
6
  end
7
7
 
8
8
  def run
9
+ Redshifter.config.logger.info "Extracting rows in batches ..."
9
10
  extracted_s3_urls = Util::ExtractAndTransformUpdates
10
11
  .new(table: table,
11
12
  since: Table::EPOCH_TIMESTAMP,
12
13
  s3_util: s3_util
13
14
  ).run
14
15
 
16
+ Redshifter.config.logger.info "Extracted #{extracted_s3_urls.size} batches. "
17
+
15
18
  if extracted_s3_urls.any?
19
+ Redshifter.config.logger.info "Writing manifest file to S3 ..."
16
20
  manifest_url = Util::S3ManifestWriter
17
21
  .new(file_name: "#{SecureRandom.uuid}.manifest",
18
22
  file_urls: extracted_s3_urls,
19
23
  s3_util: s3_util
20
24
  ).run
21
25
 
26
+ Redshifter.config.logger.info "Replacing Redshift table ..."
22
27
  Util::CreateOrReplaceTable
23
28
  .new(table: table,
24
29
  manifest_url: manifest_url
25
30
  ).run
26
31
  end
32
+
33
+ Redshifter.config.logger.info "Extract and replace completed successfully!"
27
34
  end
28
35
 
29
36
  private
@@ -6,6 +6,7 @@ module Redshifter
6
6
  end
7
7
 
8
8
  def run
9
+ Redshifter.config.logger.info "Extracting rows in batches ..."
9
10
  extracted_s3_urls = Util::ExtractAndTransformUpdates
10
11
  .new(table: table,
11
12
  since: table.redshift_last_update,
@@ -13,17 +14,21 @@ module Redshifter
13
14
  ).run
14
15
 
15
16
  if extracted_s3_urls.any?
17
+ Redshifter.config.logger.info "Writing manifest file to S3 ..."
16
18
  manifest_url = Util::S3ManifestWriter
17
19
  .new(file_name: "#{SecureRandom.uuid}.manifest",
18
20
  file_urls: extracted_s3_urls,
19
21
  s3_util: s3_util
20
22
  ).run
21
23
 
24
+ Redshifter.config.logger.info "Updating Redshift table ..."
22
25
  Util::UpdateTable
23
26
  .new(table: table,
24
27
  manifest_url: manifest_url
25
28
  ).run
26
29
  end
30
+
31
+ Redshifter.config.logger.info "Extract and update completed successfully!"
27
32
  end
28
33
 
29
34
  private
@@ -18,7 +18,7 @@ module Redshifter
18
18
 
19
19
  # Writes pipe delimited 'CSV' files to S3 of updated records.
20
20
  # Returns a list of internal s3 URLs created
21
- def run(batch_size: 1000)
21
+ def run(batch_size: 10000)
22
22
  uploaded_s3_urls = []
23
23
  run_name = SecureRandom.uuid
24
24
 
@@ -65,6 +65,8 @@ module Redshifter
65
65
  # remove the injected id from the first column
66
66
  rows.map! { |row| row[1..-1] }
67
67
 
68
+ Redshifter.config.logger.info "Extracting batch #{batch_count} ..."
69
+
68
70
  yield rows, batch_count
69
71
 
70
72
  break if rows.size < batch_size
@@ -1,3 +1,3 @@
1
1
  module Redshifter
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redshifter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Richard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-30 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynosaur