kura 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +16 -0
- data/lib/kura/client.rb +42 -4
- data/lib/kura/version.rb +1 -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: afeddc460c9e0c9ad0b34eb12e0c162271774dc6
|
4
|
+
data.tar.gz: 313412d9b2195bf4b57f6d3214eadb762c257c7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92432abce43b19932f34d3722828c58fd783c34f0a31271534765c256d86d2285ba522608c6327c402c842507555a87b7cffe7cc2756a5a3186755daa595cd16
|
7
|
+
data.tar.gz: e7e09872aeedc94f1f57250cffc47d8af86fa53a7bcf6f6d731f100f65aa2ba0d3b8b7d622172d475d1c299100e44aeac5730f9ff7db736cad473a69d3d6b853
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# 0.2.1
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
5
|
+
* Add Kura::Client#insert_table. Support tables.insert API.
|
6
|
+
* Add Kura::Client#patch_table. Support tables.patch API.
|
7
|
+
|
8
|
+
## Fixes
|
9
|
+
|
10
|
+
* Kura::Client#patch_dataset is now able to reset fiendly_name, description,
|
11
|
+
default_expiration_ms by nil.
|
12
|
+
|
13
|
+
# 0.2.0
|
14
|
+
|
15
|
+
* Use google-api-client-0.9.3.pre3.
|
16
|
+
|
1
17
|
# 0.1.5
|
2
18
|
|
3
19
|
## Enhancements
|
data/lib/kura/client.rb
CHANGED
@@ -82,12 +82,12 @@ module Kura
|
|
82
82
|
process_error($!)
|
83
83
|
end
|
84
84
|
|
85
|
-
def patch_dataset(dataset_id, project_id: @default_project_id, access: nil, description:
|
85
|
+
def patch_dataset(dataset_id, project_id: @default_project_id, access: nil, description: :na, default_table_expiration_ms: :na, friendly_name: :na )
|
86
86
|
obj = Google::Apis::BigqueryV2::Dataset.new(dataset_reference: Google::Apis::BigqueryV2::DatasetReference.new(project_id: project_id, dataset_id: dataset_id))
|
87
87
|
obj.access = access if access
|
88
|
-
obj.default_table_expiration_ms = default_table_expiration_ms if default_table_expiration_ms
|
89
|
-
obj.description = description if description
|
90
|
-
obj.friendly_name = friendly_name if friendly_name
|
88
|
+
obj.default_table_expiration_ms = default_table_expiration_ms if default_table_expiration_ms != :na
|
89
|
+
obj.description = description if description != :na
|
90
|
+
obj.friendly_name = friendly_name if friendly_name != :na
|
91
91
|
@api.patch_dataset(project_id, dataset_id, obj)
|
92
92
|
rescue
|
93
93
|
process_error($!)
|
@@ -107,6 +107,44 @@ module Kura
|
|
107
107
|
process_error($!)
|
108
108
|
end
|
109
109
|
|
110
|
+
def insert_table(dataset_id, table_id, project_id: @default_project_id, expiration_time: nil,
|
111
|
+
friendly_name: nil, schema: nil, description: nil,
|
112
|
+
query: nil, external_data_configuration: nil)
|
113
|
+
if expiration_time
|
114
|
+
expiration_time = (expiration_time.to_f * 1000.0).to_i
|
115
|
+
end
|
116
|
+
if query
|
117
|
+
view = { query: query }
|
118
|
+
elsif external_data_configuration
|
119
|
+
elsif schema
|
120
|
+
schema = { fields: normalize_schema(schema) }
|
121
|
+
end
|
122
|
+
table = Google::Apis::BigqueryV2::Table.new(
|
123
|
+
table_reference: {project_id: project_id, dataset_id: dataset_id, table_id: table_id},
|
124
|
+
friendly_name: friendly_name,
|
125
|
+
description: description,
|
126
|
+
schema: schema,
|
127
|
+
expiration_time: expiration_time,
|
128
|
+
view: view,
|
129
|
+
external_data_configuration: external_data_configuration)
|
130
|
+
@api.insert_table(project_id, dataset_id, table)
|
131
|
+
rescue
|
132
|
+
process_error($!)
|
133
|
+
end
|
134
|
+
|
135
|
+
def patch_table(dataset_id, table_id, project_id: @default_project_id, expiration_time: :na, friendly_name: :na, description: :na)
|
136
|
+
if expiration_time != :na and not(expiration_time.nil?)
|
137
|
+
expiration_time = (expiration_time.to_f * 1000.0).to_i
|
138
|
+
end
|
139
|
+
table = Google::Apis::BigqueryV2::Table.new(table_reference: {project_id: project_id, dataset_id: dataset_id, table_id: table_id})
|
140
|
+
table.friendly_name = friendly_name if friendly_name != :na
|
141
|
+
table.description = description if description != :na
|
142
|
+
table.expiration_time = expiration_time if expiration_time != :na
|
143
|
+
@api.patch_table(project_id, dataset_id, table_id, table)
|
144
|
+
rescue
|
145
|
+
process_error($!)
|
146
|
+
end
|
147
|
+
|
110
148
|
def delete_table(dataset_id, table_id, project_id: @default_project_id)
|
111
149
|
@api.delete_table(project_id, dataset_id, table_id)
|
112
150
|
rescue
|
data/lib/kura/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kura
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chikanaga Tomoyuki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|