rbhive 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rbhive/connection.rb +10 -6
  2. metadata +3 -3
@@ -73,8 +73,8 @@ module RBHive
73
73
  safe do
74
74
  execute_unsafe(query)
75
75
  rows = client.fetchAll
76
- schema = SchemaDefinition.new(client.getSchema, rows.first)
77
- ResultSet.new(rows, schema)
76
+ the_schema = SchemaDefinition.new(client.getSchema, rows.first)
77
+ ResultSet.new(rows, the_schema)
78
78
  end
79
79
  end
80
80
 
@@ -82,8 +82,8 @@ module RBHive
82
82
  safe do
83
83
  execute_unsafe(query)
84
84
  until (next_batch = client.fetchN(batch_size)).empty?
85
- schema ||= SchemaDefinition.new(client.getSchema, next_batch.first)
86
- yield ResultSet.new(next_batch, schema)
85
+ the_schema ||= SchemaDefinition.new(client.getSchema, next_batch.first)
86
+ yield ResultSet.new(next_batch, the_schema)
87
87
  end
88
88
  end
89
89
  end
@@ -92,11 +92,15 @@ module RBHive
92
92
  safe do
93
93
  execute_unsafe(query)
94
94
  row = client.fetchOne
95
- schema = SchemaDefinition.new(client.getSchema, row)
96
- ResultSet.new([row], schema).first
95
+ the_schema = SchemaDefinition.new(client.getSchema, row)
96
+ ResultSet.new([row], the_schema).first
97
97
  end
98
98
  end
99
99
 
100
+ def schema(example_row=[])
101
+ safe { SchemaDefinition.new(client.getSchema, example_row) }
102
+ end
103
+
100
104
  def create_table(schema)
101
105
  execute(schema.create_table_statement)
102
106
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbhive
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Forward Internet Group