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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/etht/bigquery.rb +16 -13
- data/lib/etht/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc50ecfc4f0b90106f5ed792e2c870d6c6d00283f2f9b18005b27c28eeef15e
|
4
|
+
data.tar.gz: b20bbd45722191045ce9b3ade80590463e8f6529b1af9af4ed045b9a4ea4986a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917ffdc49fe414e5a28fcd92c1c5d8308bfb7833c8a4acfcbe648e4726be9be914319f7c99d6326177a0bab1880b7399e1cb8c0cf655f220cc12bf30576b877f
|
7
|
+
data.tar.gz: 6b69eb9c67c40d66d224094e99b478b71128f7b5c53c4ab2c3496136dc58b2a348d58a61d25aef8b93d24bad4ecd3e2952b51123df618342857ce90c46ff48aa
|
data/Gemfile.lock
CHANGED
data/lib/etht/bigquery.rb
CHANGED
@@ -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
|
136
|
+
# @param cmd (see sql)
|
135
137
|
# @return [Boolean] job ok?
|
136
|
-
def job?(
|
137
|
-
@job = api.query_job(
|
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
|
145
|
+
# cria Structured Query Language (SQL) job bigquery
|
144
146
|
#
|
145
|
-
# @param
|
146
|
-
# @
|
147
|
-
|
148
|
-
|
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
|
154
|
+
# cria Data Manipulation Language (DML) job bigquery
|
152
155
|
#
|
153
|
-
# @param (see
|
154
|
-
# @return [
|
155
|
-
def
|
156
|
-
job?(
|
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
|
data/lib/etht/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|