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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9b3cd29abd815321af3cb724be1768fc8baee68
4
- data.tar.gz: 339d15edb49527ded87f26b60118dd445bf7ac99
3
+ metadata.gz: eeb82b2183f29098f53b27396436dcda0ea10c39
4
+ data.tar.gz: 986185c275109248df72cdda972090ba48b20110
5
5
  SHA512:
6
- metadata.gz: b8a5b2a50d5db698945b6af77d6cacab61d9c597d6ff8fa5ab7fff681973b4ef53fa96420fe3365458db3680b8e6496045f49a484aae4e004fe8e50ae5cbda56
7
- data.tar.gz: ad9ef7d63bf2f7b6c7fdb4f310b455b9ef29c0ab8bda7706a511b053b3b7729afc71b585fb116a233fa5602eeb711883e741e523289a932df09a0eec5d3e4ba1
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
- Bigquery.client.insert_table(project_id, dataset_id, Google::Apis::BigqueryV2::Table.new({
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
@@ -1,3 +1,3 @@
1
1
  class BqFakeView
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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