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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abbdfbc43e113b76608bc2c0a4555bd5e194e9b10c4b7d89f6fe3e78509245f4
4
- data.tar.gz: 15cd76d0c3f02ed04e59254585428255686020e71603fa6633ffb022bd5f5357
3
+ metadata.gz: 893d3e23c931f4f67621e03306cb3523e2bf86affe3a4c7bd6958e5cd4a7aa12
4
+ data.tar.gz: 1fbcebdefffabad096aee653ab255329696b8e5b6e2056f4742a619ec15e3810
5
5
  SHA512:
6
- metadata.gz: 95d02421bdbe1c30b995f9a7a40d86901339380c71dac23979a5653ea0f4038c98e9f8011c6d43a32dbbee482d5ef061639a9b4c3da9a718f36b5eaa46518f9c
7
- data.tar.gz: b558a205e45be08e7401a29aa1c94db29b181c01e950019b58773b9b511dd47fb62601e520da8474dca71dc53aa688cedc73245e4b5f347c0008607a7d12ae08
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
@@ -1,3 +1,3 @@
1
1
  module QueueryClient
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -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", "~> 10.0"
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.1
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: 2019-08-30 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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.0.1
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