redshift_connector 8.0.1 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f91f71e729689abb4d8e006688ca6da92c0853050d8a06e82e90098ab4729fd9
|
4
|
+
data.tar.gz: 871d84fffd775eb4abb820b4d91b2315a64b576e90d06c19fb4c33f5cb24ff23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bd66b6346d27c293c74d74a422666cd28faa3116122458b2385e77c51b980af7686096df0feb8d37cf9cc7fb92c977dcce361667ee048321e62b89c5b445f06
|
7
|
+
data.tar.gz: 43172e49458067e5d7b0fffd53c0bd6a1a0ab3b867cf66418ecbab55a828b2c01822890559b494291f1941de5089a22b4cd5694b094aaca77e58143e3cdff543
|
data/RELEASE.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'redshift_connector/logger'
|
2
|
+
require 'redshift_connector/redshift_data_type'
|
2
3
|
require 'forwardable'
|
3
4
|
|
4
5
|
module RedshiftConnector
|
@@ -22,7 +23,14 @@ module RedshiftConnector
|
|
22
23
|
|
23
24
|
def each_row(&block)
|
24
25
|
each_object do |obj|
|
25
|
-
|
26
|
+
if @bundle.respond_to?(:has_manifest?) && @bundle.has_manifest?
|
27
|
+
obj.each_row do |row|
|
28
|
+
yield RedshiftDataType.type_cast(row, @bundle.manifest_file)
|
29
|
+
end
|
30
|
+
else
|
31
|
+
obj.each_row(&block)
|
32
|
+
end
|
33
|
+
|
26
34
|
end
|
27
35
|
end
|
28
36
|
|
@@ -68,5 +76,6 @@ module RedshiftConnector
|
|
68
76
|
yield buf unless buf.empty?
|
69
77
|
end
|
70
78
|
private :do_each_batch
|
79
|
+
|
71
80
|
end
|
72
81
|
end
|
@@ -23,8 +23,10 @@ module RedshiftConnector
|
|
23
23
|
table:,
|
24
24
|
bucket: nil,
|
25
25
|
query:,
|
26
|
+
query_params: [],
|
26
27
|
txn_id: "#{Time.now.strftime('%Y%m%d_%H%M%S')}_#{$$}",
|
27
28
|
enable_sort: false,
|
29
|
+
enable_cast: false,
|
28
30
|
logger: RedshiftConnector.logger,
|
29
31
|
quiet: false
|
30
32
|
)
|
@@ -39,8 +41,10 @@ module RedshiftConnector
|
|
39
41
|
@exporter_class.new(
|
40
42
|
ds: @ds,
|
41
43
|
query: ArbitraryQuery.new(query),
|
44
|
+
query_params: query_params,
|
42
45
|
bundle_params: bundle_params,
|
43
46
|
enable_sort: enable_sort,
|
47
|
+
enable_cast: enable_cast,
|
44
48
|
logger: logger
|
45
49
|
)
|
46
50
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
module RedshiftConnector
|
3
|
+
module RedshiftDataType
|
4
|
+
def self.type_cast(row, manifest_file)
|
5
|
+
row.zip(manifest_file.column_types).map do |value, type|
|
6
|
+
next nil if (value == '' and type != 'character varing') # null becomes '' on unload
|
7
|
+
|
8
|
+
case type
|
9
|
+
when 'smallint', 'integer', 'bigint'
|
10
|
+
value.to_i
|
11
|
+
when 'numeric', 'double precision'
|
12
|
+
value.to_f
|
13
|
+
when 'character', 'character varying'
|
14
|
+
value
|
15
|
+
when 'timestamp without time zone', 'timestamp with time zone'
|
16
|
+
Time.parse(value)
|
17
|
+
when 'date'
|
18
|
+
Date.parse(value)
|
19
|
+
when 'boolean'
|
20
|
+
value == 'true' ? true : false
|
21
|
+
else
|
22
|
+
raise "not support data type: #{type}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
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: 8.0
|
4
|
+
version: 8.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minero Aoki
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/redshift_connector/reader/exception.rb
|
160
160
|
- lib/redshift_connector/reader/redshift_csv.rb
|
161
161
|
- lib/redshift_connector/reader/tsv.rb
|
162
|
+
- lib/redshift_connector/redshift_data_type.rb
|
162
163
|
- lib/redshift_connector/s3_bucket.rb
|
163
164
|
- lib/redshift_connector/s3_data_file.rb
|
164
165
|
- lib/redshift_connector/s3_data_file_bundle.rb
|
@@ -168,7 +169,7 @@ homepage: https://github.com/bricolages/redshift_connector
|
|
168
169
|
licenses:
|
169
170
|
- MIT
|
170
171
|
metadata: {}
|
171
|
-
post_install_message:
|
172
|
+
post_install_message:
|
172
173
|
rdoc_options: []
|
173
174
|
require_paths:
|
174
175
|
- lib
|
@@ -183,8 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
184
|
- !ruby/object:Gem::Version
|
184
185
|
version: '0'
|
185
186
|
requirements: []
|
186
|
-
rubygems_version: 3.1.
|
187
|
-
signing_key:
|
187
|
+
rubygems_version: 3.1.6
|
188
|
+
signing_key:
|
188
189
|
specification_version: 4
|
189
190
|
summary: Redshift bulk data connector
|
190
191
|
test_files: []
|