bigquery-client 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bigquery-client/jobs.rb +1 -1
- data/lib/bigquery-client/version.rb +1 -1
- data/test/test_jobs.rb +17 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a86e09fec3bb6175a2d99264a10a139b742f14c
|
4
|
+
data.tar.gz: 475d160a52fbf704d02d34ceaaaaf689e6286ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 331ef756470a6586af5eb37dee614532cf1df20873fae4c12dff16207b2c087b17092771c26007137bdffac43dfc8556d550979286ab1b0be3087388109eb610
|
7
|
+
data.tar.gz: 960d58359bfd5a9687ca9a313be7a963f113fe2c948dde6f765e07199548ca93cda707332fc588ec9cc3748572ec1cafb748647495ee2ab0f12cd1ac4fcb8a13
|
data/lib/bigquery-client/jobs.rb
CHANGED
@@ -6,7 +6,7 @@ module BigQuery
|
|
6
6
|
result = jobs_query(query, options)
|
7
7
|
names = result['schema']['fields'].map {|field| field['name'] }
|
8
8
|
types = result['schema']['fields'].map {|field| field['type'] }
|
9
|
-
records = result['rows'].map {|row| row['f'].map {|record| record['v'] } }
|
9
|
+
records = (result['rows'] || []).map {|row| row['f'].map {|record| record['v'] } }
|
10
10
|
convert(records, types).map { |values| [names, values].transpose.to_h }
|
11
11
|
end
|
12
12
|
|
data/test/test_jobs.rb
CHANGED
@@ -12,11 +12,27 @@ class JobsTest < Test::Unit::TestCase
|
|
12
12
|
100
|
13
13
|
EOS
|
14
14
|
|
15
|
+
@@no_rows_query = <<-"EOS"
|
16
|
+
SELECT
|
17
|
+
born_alive_alive, mother_residence_state, is_male
|
18
|
+
FROM
|
19
|
+
publicdata:samples.natality
|
20
|
+
ORDER BY
|
21
|
+
day
|
22
|
+
LIMIT
|
23
|
+
0
|
24
|
+
EOS
|
25
|
+
|
15
26
|
def test_sql
|
16
27
|
result = $client.sql(@@query)
|
17
28
|
assert { result.size == 100 }
|
18
29
|
assert { result.sample["born_alive_alive"].is_a? Fixnum }
|
19
30
|
assert { result.sample["mother_residence_state"].is_a? String }
|
20
|
-
assert { result.
|
31
|
+
assert { result.first["is_male"] == true || result.first["is_male"] == false }
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_sql_when_no_rows
|
35
|
+
result = $client.sql(@@no_rows_query)
|
36
|
+
assert { result == [] }
|
21
37
|
end
|
22
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigquery-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsukuru Tanimichi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|