bigquery_migration 0.1.0.pre1 → 0.1.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/bigquery_migration/bigquery_wrapper.rb +14 -17
- data/lib/bigquery_migration/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: f0252b004ebb12b8b9811410d3340ef96f24f536
|
4
|
+
data.tar.gz: 896836c4306cc278cbcc761f66ae5b6f4c35deb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17adead80000680261ee459ce8a590b09c3ad4723326f2354dcbdb353e388c5e0bcb3b896a919e8beb989250a1637f9865be2b1ba76ad75b400eaeec8d249fbf
|
7
|
+
data.tar.gz: 0aadefd1fb891fdb7b6b3f9e41d71138b833626600b6804521e4c4c39e982ee7ef0ef0147696467a832f6b306cf955732a26854a5f315be70be5eab2e716b1d8
|
data/README.md
CHANGED
@@ -20,6 +20,8 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
+
Define your desired schema, this tool automatically detects differences with the target table, and takes core of adding columns, or dropping columns (actually, select & copy is issued), or changing types.
|
24
|
+
|
23
25
|
### CLI
|
24
26
|
|
25
27
|
config.yml
|
@@ -23,7 +23,7 @@ class BigqueryMigration
|
|
23
23
|
|
24
24
|
def configure
|
25
25
|
if json_keyfile = config[:json_keyfile]
|
26
|
-
|
26
|
+
json_key =
|
27
27
|
case json_keyfile
|
28
28
|
when String
|
29
29
|
File.read(json_keyfile)
|
@@ -32,24 +32,21 @@ class BigqueryMigration
|
|
32
32
|
else
|
33
33
|
raise ConfigError.new "Unsupported json_keyfile type"
|
34
34
|
end
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
rescue => e
|
47
|
-
raise ConfigError.new "json_keyfile is not a JSON file"
|
48
|
-
end
|
35
|
+
json_keyparams =
|
36
|
+
begin
|
37
|
+
case json_key
|
38
|
+
when String
|
39
|
+
HashUtil.deep_symbolize_keys(JSON.parse(json_key))
|
40
|
+
when Hash
|
41
|
+
HashUtil.deep_symbolize_keys(json_key)
|
42
|
+
end
|
43
|
+
rescue => e
|
44
|
+
raise ConfigError.new "json_keyfile is not a JSON file"
|
45
|
+
end
|
49
46
|
end
|
50
47
|
|
51
|
-
if
|
52
|
-
config[:project] ||=
|
48
|
+
if json_keyparams
|
49
|
+
config[:project] ||= json_keyparams[:project_id]
|
53
50
|
end
|
54
51
|
|
55
52
|
config[:retries] ||= 5
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigquery_migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|