activerecord-hbase-adapter 0.0.71 → 0.0.81
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/activerecord-hbase-adapter.gemspec +2 -0
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +1 -1
- data/lib/active_record/connection_adapters/hbase/client.rb +9 -12
- data/lib/active_record/connection_adapters/hbase/result.rb +7 -0
- data/lib/active_record/connection_adapters/hbase/time.rb +7 -0
- data/lib/active_record/connection_adapters/hbase_adapter.rb +15 -11
- data/lib/activerecord-hbase-adapter.rb +9 -0
- data/lib/activerecord-hbase-adapter/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78e884a73503282cda54f49a0bf77a7ededca706
|
4
|
+
data.tar.gz: dd61912a721ace8f23fbc75ed473c212db0a4488
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c145ade2cb4534191d4e6948eaae4755db849545ba78bca47b902c39f1d82cd82710f2748049a872d78e580afce158f966b8bfaa3b65c514a99d53ad5d04007a
|
7
|
+
data.tar.gz: c9afa8ebf276b1abe0328ed3b6ca678e5761722902687e7efe210286eb095ffae4ec3d16e8f6e069eb65434d602d92bafe38010e9d1f00a02208d2556c082ef1
|
@@ -10,9 +10,11 @@ Gem::Specification.new do |gem|
|
|
10
10
|
|
11
11
|
gem.files = [ 'Gemfile',
|
12
12
|
'activerecord-hbase-adapter.gemspec',
|
13
|
+
'lib/activerecord-hbase-adapter.rb',
|
13
14
|
'lib/activerecord-hbase-adapter/version.rb',
|
14
15
|
'lib/active_record/connection_adapters/hbase_adapter.rb',
|
15
16
|
'lib/active_record/connection_adapters/abstract_mysql_adapter.rb',
|
17
|
+
'lib/active_record/connection_adapters/hbase/time.rb',
|
16
18
|
'lib/active_record/connection_adapters/hbase/error.rb',
|
17
19
|
'lib/active_record/connection_adapters/hbase/result.rb',
|
18
20
|
'lib/active_record/connection_adapters/hbase/client.rb']
|
@@ -304,7 +304,7 @@ module ActiveRecord
|
|
304
304
|
#result = @connection.query('SELECT `mythings`.* FROM `mythings`')
|
305
305
|
result = @connection.query(sql)
|
306
306
|
File.open('/tmp/thing.txt', 'a') { |file| file.write("\n#{result.inspect}") }
|
307
|
-
#binding.pry
|
307
|
+
#binding.pry if sql == "SHOW FULL FIELDS FROM `schema_migrations`"
|
308
308
|
#puts $the_e.inspect
|
309
309
|
log(sql, name) { result }
|
310
310
|
end
|
@@ -26,16 +26,15 @@ module HbaseRestIface
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def query(sql)
|
29
|
-
|
29
|
+
File.open('/tmp/thing.txt', 'a') { |file| file.write("\n!!query\n#{sql}") }
|
30
30
|
query_object = HipsterSqlToHbase.parse_hash(sql)
|
31
|
-
|
31
|
+
File.open('/tmp/thing.txt', 'a') { |file| file.write("\n#{query_object.inspect}") }
|
32
32
|
begin
|
33
|
-
|
34
|
-
result
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
Hbase::Result.new()
|
33
|
+
result = secure_request("/exec", { body: {query: MessagePack.pack(query_object)} })
|
34
|
+
Hbase::Result.new(result) unless result.nil?
|
35
|
+
rescue Exception => e
|
36
|
+
File.open('/tmp/thing.txt', 'a') { |file| file.write("\n\n!!!error\n#{e.message}") }
|
37
|
+
nil
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
@@ -57,8 +56,7 @@ module HbaseRestIface
|
|
57
56
|
end
|
58
57
|
|
59
58
|
if response.code.to_s =~ /2\d\d/
|
60
|
-
|
61
|
-
JSON.parse(response.body)
|
59
|
+
MessagePack.unpack(response.body)
|
62
60
|
else
|
63
61
|
error = Nokogiri::HTML(response.body)
|
64
62
|
#binding.pry
|
@@ -74,8 +72,7 @@ module HbaseRestIface
|
|
74
72
|
end
|
75
73
|
|
76
74
|
if response.code.to_s =~ /2\d\d/
|
77
|
-
|
78
|
-
JSON.parse(response.body)
|
75
|
+
MessagePack.unpack(response.body)
|
79
76
|
else
|
80
77
|
error = Nokogiri::HTML(response.body)
|
81
78
|
#binding.pry
|
@@ -5,6 +5,13 @@ module Hbase
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
7
|
attr_accessor :members
|
8
|
+
|
9
|
+
### Keeping this just in case, for now
|
10
|
+
# def self.new(result = {'fields' => [], 'results' => []})
|
11
|
+
# return nil if result['fields'].length < 1 && result['results'].length < 1
|
12
|
+
#
|
13
|
+
# super
|
14
|
+
# end
|
8
15
|
|
9
16
|
def initialize(result = {'fields' => [], 'results' => []})
|
10
17
|
@result = result
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'active_record/connection_adapters/abstract_mysql_adapter'
|
2
|
+
require 'active_record/connection_adapters/hbase/time'
|
2
3
|
require 'active_record/connection_adapters/hbase/error'
|
3
4
|
require 'active_record/connection_adapters/hbase/result'
|
4
5
|
require 'active_record/connection_adapters/hbase/client'
|
5
6
|
|
6
7
|
### FOR DEBUGGING ONLY ###
|
7
|
-
|
8
|
-
|
8
|
+
$LOAD_PATH.unshift '/home/jean/adapter/lib/mysql2/lib'
|
9
|
+
require 'mysql2'
|
9
10
|
### FOR DEBUGGING ONLY ###
|
10
11
|
|
11
12
|
require 'hipster_sql_to_hbase'
|
@@ -18,16 +19,19 @@ module ActiveRecord
|
|
18
19
|
|
19
20
|
config[:username] = 'root' if config[:username].nil?
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
if !config[:m2debug].nil?
|
23
|
+
### FOR DEBUGGING ONLY ###
|
24
|
+
if Mysql2::Client.const_defined? :FOUND_ROWS
|
25
|
+
config[:flags] = Mysql2::Client::FOUND_ROWS
|
26
|
+
end
|
27
|
+
config[:host] = config[:m2host]
|
28
|
+
config[:port] = config[:m2port]
|
29
|
+
client = Mysql2::Client.new(config)
|
30
|
+
### FOR DEBUGGING ONLY ###
|
31
|
+
else
|
32
|
+
client = HbaseRestIface::Client.new(config)
|
33
|
+
end
|
29
34
|
|
30
|
-
client = HbaseRestIface::Client.new(config)
|
31
35
|
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
|
32
36
|
ConnectionAdapters::HbaseAdapter.new(client, logger, options, config)
|
33
37
|
rescue Hbase::Error => error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-hbase-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.81
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Lescure
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hipster_sql_to_hbase
|
@@ -79,7 +79,9 @@ files:
|
|
79
79
|
- lib/active_record/connection_adapters/hbase/client.rb
|
80
80
|
- lib/active_record/connection_adapters/hbase/error.rb
|
81
81
|
- lib/active_record/connection_adapters/hbase/result.rb
|
82
|
+
- lib/active_record/connection_adapters/hbase/time.rb
|
82
83
|
- lib/active_record/connection_adapters/hbase_adapter.rb
|
84
|
+
- lib/activerecord-hbase-adapter.rb
|
83
85
|
- lib/activerecord-hbase-adapter/version.rb
|
84
86
|
homepage: http://github.com/jeanlescure/activerecord-hbase-adapter
|
85
87
|
licenses: []
|