queuery_client 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/queuery_client/client.rb +23 -0
- data/lib/queuery_client/version.rb +1 -1
- data/queuery_client.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 893d3e23c931f4f67621e03306cb3523e2bf86affe3a4c7bd6958e5cd4a7aa12
|
4
|
+
data.tar.gz: 1fbcebdefffabad096aee653ab255329696b8e5b6e2056f4742a619ec15e3810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e7ac1fc3d9b850fc0d7d9261c1db44664511997ec17789dd153d9faf9296af7caa689561d30cfde7e07918d43331fbd11b92a1704c9781b489bb3b17704a4e3
|
7
|
+
data.tar.gz: 59ca2f54c33e271ffa93d59c224fa98ae11b729152407b5b7691413bce1ca2b4a2ec6b14f9a6c6253cade2fe1bee290aa12f6496daa821441e9d7e9092b3cf91
|
@@ -7,6 +7,7 @@ module QueueryClient
|
|
7
7
|
def execute_query(select_stmt, values)
|
8
8
|
garage_client.post("/v1/queries", q: select_stmt, values: values)
|
9
9
|
end
|
10
|
+
alias start_query execute_query
|
10
11
|
|
11
12
|
def get_query(id)
|
12
13
|
garage_client.get("/v1/queries/#{id}", fields: '__default__,s3_prefix')
|
@@ -41,6 +42,12 @@ module QueueryClient
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
45
|
+
# poll_result returns the results only if the query has already successed.
|
46
|
+
def poll_result(id)
|
47
|
+
query = get_query(id)
|
48
|
+
get_query_result(query)
|
49
|
+
end
|
50
|
+
|
44
51
|
def garage_client
|
45
52
|
@garage_client ||= BasicAuthGarageClient.new(
|
46
53
|
endpoint: options.endpoint,
|
@@ -57,5 +64,21 @@ module QueueryClient
|
|
57
64
|
def default_options
|
58
65
|
QueueryClient.configuration
|
59
66
|
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def get_query_result(query)
|
71
|
+
case query.status
|
72
|
+
when 'pending', 'running'
|
73
|
+
nil
|
74
|
+
when 'success'
|
75
|
+
UrlDataFileBundle.new(
|
76
|
+
query.data_file_urls,
|
77
|
+
s3_prefix: query.s3_prefix,
|
78
|
+
)
|
79
|
+
when 'failure'
|
80
|
+
raise QueryError.new(query.error)
|
81
|
+
end
|
82
|
+
end
|
60
83
|
end
|
61
84
|
end
|
data/queuery_client.gemspec
CHANGED
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_dependency 'redshift_csv_file'
|
33
33
|
spec.add_dependency 'aws-sdk-s3'
|
34
34
|
spec.add_development_dependency "bundler", "~> 1.13"
|
35
|
-
spec.add_development_dependency "rake", "~>
|
35
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
36
36
|
spec.add_development_dependency "pry"
|
37
37
|
end
|
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.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hidekazu Kobayashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: garage_client
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '12.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '12.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.1.2
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Client library for Queuery Redshift HTTP API
|