bq_fake_view 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bq_fake_view.gemspec +1 -0
- data/lib/bq_fake_view.rb +4 -2
- data/lib/bq_fake_view/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeb82b2183f29098f53b27396436dcda0ea10c39
|
4
|
+
data.tar.gz: 986185c275109248df72cdda972090ba48b20110
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dfaa4ccfee855850516051c8af3536a57ccdbdd77177321d706786d860156ba9c19083840129b8d5843a00cb072ed42c4e671afb16fb4bb74a45b4751d1aaf3
|
7
|
+
data.tar.gz: 0832dec4a59c5f7f49c1394929545e3776a44ed14e26e60ba86a13fb07ca81f705af1310579a5d175714988d72e2653fab866a9de273fc9a09ec7ae52af23ba9
|
data/bq_fake_view.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_runtime_dependency "google-api-client", "~> 0.9.pre3"
|
22
|
+
spec.add_runtime_dependency "activesupport", ">= 4"
|
22
23
|
spec.add_development_dependency "bundler", "~> 1.11"
|
23
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
25
|
end
|
data/lib/bq_fake_view.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require "bq_fake_view/version"
|
2
2
|
|
3
|
+
require 'active_support/core_ext/time'
|
4
|
+
require 'active_support/core_ext/date'
|
3
5
|
require 'google/apis/bigquery_v2'
|
4
6
|
|
5
7
|
class BqFakeView
|
@@ -15,7 +17,7 @@ class BqFakeView
|
|
15
17
|
def create_view(project_id, dataset_id, name, rows, schema)
|
16
18
|
query = view_query(rows, schema)
|
17
19
|
|
18
|
-
|
20
|
+
@bigquery.insert_table(project_id, dataset_id, Google::Apis::BigqueryV2::Table.new({
|
19
21
|
table_reference: {
|
20
22
|
project_id: project_id,
|
21
23
|
dataset_id: dataset_id,
|
@@ -36,7 +38,7 @@ class BqFakeView
|
|
36
38
|
|
37
39
|
def sql_from_hash(row, schema)
|
38
40
|
cols = row.map do |k, v|
|
39
|
-
field = schema.find { |f| f[:name] == k }
|
41
|
+
field = schema.find { |f| f[:name].to_s == k.to_s }
|
40
42
|
raise FieldNotFound, "#{k} is not found from schema" unless field
|
41
43
|
"#{cast_to_sql_value(v, field[:type])} as #{k}"
|
42
44
|
end
|
data/lib/bq_fake_view/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bq_fake_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joker1007
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.9.pre3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|