queuery_client 1.1.0 → 1.1.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a1006fdef0ce698e6d38c02fcbeaab4ef928a7be704395d57da8ae963b94301
|
4
|
+
data.tar.gz: 70b2fc77eeb6ed27047db209f3aa89cd4a0b5c83fb4616535134e8d14ce537f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a0338752a52c4f67f94823139bbc78b736a24c143176e5a521c832c2dcb23bda57b3c18adfa0deacc9ab5e52e3dc43728d26db3b790b6bf5dbe64c809f0f9ff
|
7
|
+
data.tar.gz: 6f8c7c248f55ba26763e7ff90d2f52c42c9d3776bf690440dd9f3aeda1b22c3f76c109fbe705ead7fc65f03c27a4e7257f0ed2b8976e2e5f27ebafc5ac09fbae
|
@@ -14,14 +14,23 @@ module QueueryClient
|
|
14
14
|
garage_client.get("/v1/queries/#{id}", fields: '__default__,s3_prefix' + query_option_fields)
|
15
15
|
end
|
16
16
|
|
17
|
+
MAX_POLLING_INTERVAL = 30
|
18
|
+
|
17
19
|
def wait_for(id, query_options)
|
20
|
+
n = 1
|
18
21
|
loop do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
begin
|
23
|
+
query = get_query(id, query_options)
|
24
|
+
case query.status
|
25
|
+
when 'success', 'failed'
|
26
|
+
return query
|
27
|
+
end
|
28
|
+
rescue GarageClient::GatewayTimeout
|
29
|
+
warn "#{$PROGRAM_NAME}: warning: queuery polling timeout occurred"
|
23
30
|
end
|
24
|
-
|
31
|
+
polling_interval = [3 * n, MAX_POLLING_INTERVAL].min
|
32
|
+
sleep polling_interval
|
33
|
+
n += 1
|
25
34
|
end
|
26
35
|
end
|
27
36
|
|
@@ -1,6 +1,17 @@
|
|
1
1
|
|
2
2
|
module QueueryClient
|
3
3
|
module RedshiftDataType
|
4
|
+
FALSE_VALUES = [
|
5
|
+
false, 0,
|
6
|
+
"0", :"0",
|
7
|
+
"f", :f,
|
8
|
+
"F", :F,
|
9
|
+
"false", :false,
|
10
|
+
"FALSE", :FALSE,
|
11
|
+
"off", :off,
|
12
|
+
"OFF", :OFF,
|
13
|
+
].to_set.freeze
|
14
|
+
|
4
15
|
def self.type_cast(row, manifest_file)
|
5
16
|
row.zip(manifest_file.column_types).map do |value, type|
|
6
17
|
next nil if (value == '' and type != 'character varing') # null becomes '' on unload
|
@@ -13,11 +24,11 @@ module QueueryClient
|
|
13
24
|
when 'character', 'character varying'
|
14
25
|
value
|
15
26
|
when 'timestamp without time zone', 'timestamp with time zone'
|
16
|
-
|
27
|
+
value # Ruby does not have a class without timezone
|
17
28
|
when 'date'
|
18
29
|
Date.parse(value)
|
19
30
|
when 'boolean'
|
20
|
-
value
|
31
|
+
FALSE_VALUES.include?(value) ? false : true
|
21
32
|
else
|
22
33
|
raise "not support data type: #{type}"
|
23
34
|
end
|
@@ -23,13 +23,19 @@ module QueueryClient
|
|
23
23
|
|
24
24
|
def data_files
|
25
25
|
b = Aws::S3::Resource.new(client: @s3_client).bucket(@bucket)
|
26
|
-
b.objects(prefix: @prefix)
|
26
|
+
b.objects(prefix: @prefix)
|
27
|
+
.select {|obj| obj.key.include?('_part_') }
|
28
|
+
.map {|obj| S3DataFile.new(obj) }
|
27
29
|
end
|
28
30
|
|
29
31
|
def manifest_file
|
30
32
|
b = Aws::S3::Resource.new(client: @s3_client).bucket(@bucket)
|
31
33
|
obj = b.object("#{@prefix}manifest")
|
32
|
-
|
34
|
+
if obj.exists?
|
35
|
+
S3ManifestFile.new(obj)
|
36
|
+
else
|
37
|
+
nil
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
def has_manifest?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queuery_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hidekazu Kobayashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: garage_client
|