redshift-connector 7.0.0 → 7.0.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: bc258b0cae8475c5c78a9e37ebb80e16d186245d
4
- data.tar.gz: 9c8c846b8bfb89714986146b019aa063bcfee9af
3
+ metadata.gz: 2a4d66a20517246040bb90868247fd86afcf9b2a
4
+ data.tar.gz: f65cf5432e970b663762c2ef25d8953c01c3a449
5
5
  SHA512:
6
- metadata.gz: 8e9001439475fc25dfbc6c0eda67306044dccb7c5eeda5309fa2995df4adeaa5b028e3a177f33ca938b99d150ea10a8e48206479b0532f26f2eb17b59b5bf791
7
- data.tar.gz: 1d83a4852630ab542bb14cc4fac376a08f549aec0d4225d92f65852f5af290c06d3c44ba31660991370707d9763322ad9d01daba9ff0a1dad352f88d4c0db6ff
6
+ metadata.gz: 8d0c198cdf127d1ca1fd13a9552852100f990e5fc6a44f02b0f53e1f31905b03dee9b3d0b377f00cfb497514366f3df2079193015c51b92dc260f391c4c4eee4
7
+ data.tar.gz: 1da370161d79fde4d8c8b24feb04fcf5bee6fb141e9ba11c08034e0cb3d28afb56c1ab1e9447b7746dca2b42bbdb96637a6dceee6f5d6f5390b09076a613cf24
@@ -5,6 +5,7 @@ require 'redshift_connector/connector'
5
5
  require 'redshift_connector/exporter'
6
6
  require 'redshift_connector/active_record_data_source'
7
7
  require 'redshift_connector/active_record_exporter'
8
+ require 'redshift_connector/immediate_exporter'
8
9
  require 'redshift_connector/importer'
9
10
  require 'redshift_connector/s3_bucket'
10
11
  require 'redshift_connector/s3_data_file_bundle'
@@ -21,11 +22,11 @@ module RedshiftConnector
21
22
  end
22
23
 
23
24
  def RedshiftConnector.transport_delta_from_s3(**params)
24
- Importer.transport_delta_from_s3(**params)
25
+ Connector.transport_delta_from_s3(**params)
25
26
  end
26
27
 
27
28
  def RedshiftConnector.transport_all_from_s3(**params)
28
- Importer.transport_all_from_s3(**params)
29
+ Connector.transport_all_from_s3(**params)
29
30
  end
30
31
 
31
32
  def RedshiftConnector.foreach(**params, &block)
@@ -1,10 +1,43 @@
1
1
  require 'redshift_connector/exporter'
2
+ require 'redshift_connector/immediate_exporter'
2
3
  require 'redshift_connector/importer'
3
4
  require 'redshift_connector/data_file_bundle_params'
5
+ require 'redshift_connector/s3_data_file_bundle'
4
6
  require 'redshift_connector/logger'
5
7
 
6
8
  module RedshiftConnector
7
9
  class Connector
10
+ def Connector.transport_delta_from_s3(
11
+ bucket: nil,
12
+ prefix:,
13
+ format:,
14
+ filter: nil,
15
+ table:,
16
+ columns:,
17
+ delete_cond: nil,
18
+ upsert_columns: nil,
19
+ logger: RedshiftConnector.logger,
20
+ quiet: false
21
+ )
22
+ logger = NullLogger.new if quiet
23
+ bundle = S3DataFileBundle.for_prefix(
24
+ bucket: (bucket ? S3Bucket.get(bucket) : S3Bucket.default),
25
+ prefix: prefix,
26
+ format: format,
27
+ filter: filter,
28
+ logger: logger
29
+ )
30
+ exporter = ImmediateExporter.new(bundle: bundle, logger: logger)
31
+ importer = Importer.for_delta_upsert(
32
+ table: table,
33
+ columns: columns,
34
+ delete_cond: delete_cond,
35
+ upsert_columns: upsert_columns,
36
+ logger: logger
37
+ )
38
+ new(exporter: exporter, importer: importer, logger: logger)
39
+ end
40
+
8
41
  def Connector.transport_delta(
9
42
  schema:,
10
43
  table: nil,
@@ -50,6 +83,35 @@ module RedshiftConnector
50
83
  new(exporter: exporter, importer: importer, logger: logger)
51
84
  end
52
85
 
86
+ def Connector.transport_all_from_s3(
87
+ strategy: 'rename',
88
+ table:,
89
+ columns:,
90
+ bucket: nil,
91
+ prefix:,
92
+ format:,
93
+ filter: nil,
94
+ logger: RedshiftConnector.logger,
95
+ quiet: false
96
+ )
97
+ logger = NullLogger.new if quiet
98
+ bundle = S3DataFileBundle.for_prefix(
99
+ bucket: (bucket ? S3Bucket.get(bucket) : S3Bucket.default),
100
+ prefix: prefix,
101
+ format: format,
102
+ filter: filter,
103
+ logger: logger
104
+ )
105
+ exporter = ImmediateExporter.new(bundle: bundle, logger: logger)
106
+ importer = Importer.for_rebuild(
107
+ strategy: strategy,
108
+ table: table,
109
+ columns: columns,
110
+ logger: logger
111
+ )
112
+ new(exporter: exporter, importer: importer, logger: logger)
113
+ end
114
+
53
115
  def Connector.transport_all(
54
116
  strategy: 'rename',
55
117
  schema:,
@@ -0,0 +1,19 @@
1
+ require 'redshift_connector/s3_data_file_bundle'
2
+ require 'redshift_connector/logger'
3
+
4
+ module RedshiftConnector
5
+ class ImmediateExporter
6
+ def initialize(bundle:, logger: RedshiftConnector.logger)
7
+ @bundle = bundle
8
+ @logger = logger
9
+ end
10
+
11
+ attr_reader :bundle
12
+ attr_reader :logger
13
+
14
+ def execute
15
+ @logger.info "USE #{@bundle.url}*"
16
+ @bundle
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module RedshiftConnector
2
- VERSION = '7.0.0'
2
+ VERSION = '7.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redshift-connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minero Aoki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-19 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redshift-connector-data_file
@@ -152,6 +152,7 @@ files:
152
152
  - lib/redshift_connector/exception.rb
153
153
  - lib/redshift_connector/exporter.rb
154
154
  - lib/redshift_connector/exporter_builder.rb
155
+ - lib/redshift_connector/immediate_exporter.rb
155
156
  - lib/redshift_connector/importer.rb
156
157
  - lib/redshift_connector/importer/activerecord-import.rb
157
158
  - lib/redshift_connector/importer/insert_delta.rb