bigquery 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/big_query/client/tables.rb +3 -0
- data/lib/big_query/version.rb +1 -1
- data/test/bigquery.rb +34 -7
- 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: f1780273af1d1592bd9fc5b75bc529c655d80b26
|
4
|
+
data.tar.gz: 73b136d9c55bf6976589f866ffed0366fa7cd005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2447f0bfec5ff4bee75e6593c4ee26e16832236ef42fa40c956d3d6e49e9669d9f9f6eb5f3065e62a03e7583c1b3e744764ef5be13c28e0e3c26bde301a3f6d
|
7
|
+
data.tar.gz: 4530e664ed3d3869210ecebb5f6aed94c5c674371b77edbcba4c2c93edc4f0a17b9dc756c5e54172432f07b639c34cae0f68d8f5df335f31a558ddc566268644
|
data/README.md
CHANGED
@@ -121,6 +121,9 @@ module BigQuery
|
|
121
121
|
mode = (ALLOWED_FIELD_MODES & [options[:mode].to_s]).first
|
122
122
|
field = { "name" => name.to_s, "type" => type }
|
123
123
|
field["mode"] = mode if mode
|
124
|
+
if field["type"] == 'RECORD'
|
125
|
+
field["fields"] = validate_schema(options[:fields])
|
126
|
+
end
|
124
127
|
fields << field
|
125
128
|
end
|
126
129
|
fields
|
data/lib/big_query/version.rb
CHANGED
data/test/bigquery.rb
CHANGED
@@ -20,11 +20,10 @@ class BigQueryTest < MiniTest::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_for_tables
|
23
|
-
|
23
|
+
table = @bq.tables.select{|t| t['id'] == "#{config['project_id']}:#{config['dataset']}.test"}.first
|
24
24
|
|
25
|
-
assert_equal
|
26
|
-
assert_equal
|
27
|
-
assert_equal tables[0]['tableReference']['tableId'], 'test'
|
25
|
+
assert_equal table['kind'], "bigquery#table"
|
26
|
+
assert_equal table['tableReference']['tableId'], 'test'
|
28
27
|
end
|
29
28
|
|
30
29
|
def test_for_tables_formatted
|
@@ -43,11 +42,39 @@ class BigQueryTest < MiniTest::Unit::TestCase
|
|
43
42
|
if @bq.tables_formatted.include? 'test123'
|
44
43
|
@bq.delete_table('test123')
|
45
44
|
end
|
46
|
-
|
45
|
+
|
46
|
+
schema = {
|
47
|
+
id: { type: 'INTEGER'},
|
48
|
+
city: {
|
49
|
+
name:"city",
|
50
|
+
type:"RECORD",
|
51
|
+
mode: "nullable",
|
52
|
+
fields: {
|
53
|
+
id: {name:"id", type:"INTEGER" },
|
54
|
+
name: {name:"name", type:"STRING" },
|
55
|
+
country: { name:"country", type:"STRING" },
|
56
|
+
time: { name:"time", type:"TIMESTAMP" }
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
result = @bq.create_table('test123', schema)
|
47
62
|
|
48
63
|
assert_equal result['kind'], "bigquery#table"
|
49
64
|
assert_equal result['tableReference']['tableId'], "test123"
|
50
|
-
assert_equal result['schema']['fields'], [
|
65
|
+
assert_equal result['schema']['fields'], [
|
66
|
+
{"name"=>"id", "type"=>"INTEGER"},
|
67
|
+
{
|
68
|
+
"name"=>"city",
|
69
|
+
"type"=>"RECORD",
|
70
|
+
"fields"=>[
|
71
|
+
{"name"=>"id", "type"=>"INTEGER"},
|
72
|
+
{"name"=>"name", "type"=>"STRING"},
|
73
|
+
{"name"=>"country", "type"=>"STRING"},
|
74
|
+
{"name"=>"time", "type"=>"TIMESTAMP"}
|
75
|
+
]
|
76
|
+
}
|
77
|
+
]
|
51
78
|
end
|
52
79
|
|
53
80
|
def test_for_delete_table
|
@@ -101,7 +128,7 @@ class BigQueryTest < MiniTest::Unit::TestCase
|
|
101
128
|
end
|
102
129
|
|
103
130
|
def test_for_insert_job
|
104
|
-
|
131
|
+
result = @bq.insert_job(query: {query: "SELECT * FROM [#{config['dataset']}.test] LIMIT 1"})
|
105
132
|
|
106
133
|
assert_equal result['kind'], "bigquery#job"
|
107
134
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Bronte
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: retriable
|