etht 0.1.8 → 0.1.9

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: 251284e1797817117272d9df42dc49b7a13deae5107445ca0488bd953d445b0f
4
- data.tar.gz: 3f63d4fd81f939242e9cb5cd0543f26c515a1621c65a8704995fceaccfbfadc2
3
+ metadata.gz: dcc50ecfc4f0b90106f5ed792e2c870d6c6d00283f2f9b18005b27c28eeef15e
4
+ data.tar.gz: b20bbd45722191045ce9b3ade80590463e8f6529b1af9af4ed045b9a4ea4986a
5
5
  SHA512:
6
- metadata.gz: 88873cd75be80f1b78cb760a4e643a394a16ff5fb01ee0328273e5684e19944ba7c5f344f3fd63488e009a0c2d79976bd7d0994b994062b9cf63f1c6c990f4bf
7
- data.tar.gz: b3991969370592a9ecfc8e969f7b4205b475aae29aca5029e1c005217416e1380a1a5bed8cc5c69e4efd5612332791b8eb3376a311e3d02bba6e891810a2320a
6
+ metadata.gz: 917ffdc49fe414e5a28fcd92c1c5d8308bfb7833c8a4acfcbe648e4726be9be914319f7c99d6326177a0bab1880b7399e1cb8c0cf655f220cc12bf30576b877f
7
+ data.tar.gz: 6b69eb9c67c40d66d224094e99b478b71128f7b5c53c4ab2c3496136dc58b2a348d58a61d25aef8b93d24bad4ecd3e2952b51123df618342857ce90c46ff48aa
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- etht (0.1.8)
4
+ etht (0.1.9)
5
5
  faraday
6
6
  google-cloud-bigquery
7
7
  json
@@ -15,6 +15,8 @@ module Etht
15
15
  attr_reader :job
16
16
  # @return [Thor::CoreExt::HashWithIndifferentAccess] opcoes trabalho
17
17
  attr_reader :ops
18
+ # @return (see sql)
19
+ attr_reader :sqr
18
20
 
19
21
  # @param [Thor::CoreExt::HashWithIndifferentAccess] pop opcoes trabalho
20
22
  # @option pop [Hash] :h ({}) configuracao ajuste reposicionamento temporal
@@ -131,29 +133,30 @@ module Etht
131
133
 
132
134
  # cria job bigquery & verifica execucao
133
135
  #
134
- # @param [String] sql a executar
136
+ # @param cmd (see sql)
135
137
  # @return [Boolean] job ok?
136
- def job?(sql)
137
- @job = api.query_job(sql)
138
+ def job?(cmd)
139
+ @job = api.query_job(cmd)
138
140
  @job.wait_until_done!
139
141
  puts(@job.error['message']) if @job.failed?
140
142
  @job.failed?
141
143
  end
142
144
 
143
- # cria Data Manipulation Language (DML) job bigquery
145
+ # cria Structured Query Language (SQL) job bigquery
144
146
  #
145
- # @param (see job?)
146
- # @return [Integer] numero linhas afetadas
147
- def dml(sql)
148
- job?(sql) ? 0 : job.num_dml_affected_rows
147
+ # @param [String] cmd comando SQL a executar
148
+ # @param [String] red resultado quando SQL tem erro
149
+ # @return [Google::Cloud::Bigquery::Data] resultado do SQL
150
+ def sql(cmd, red = [])
151
+ @sqr = job?(cmd) ? red : job.data
149
152
  end
150
153
 
151
- # cria Structured Query Language (SQL) job bigquery
154
+ # cria Data Manipulation Language (DML) job bigquery
152
155
  #
153
- # @param (see job?)
154
- # @return [Array<Hash>] resultados do SQL
155
- def sql(sql)
156
- job?(sql) ? [] : job.data
156
+ # @param cmd (see sql)
157
+ # @return [Integer] numero linhas afetadas
158
+ def dml(cmd)
159
+ job?(cmd) ? 0 : job.num_dml_affected_rows
157
160
  end
158
161
  end
159
162
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Etht
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etht
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-27 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler