activerecord-hbase-adapter 0.0.71 → 0.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d20cfbf09998f3be62222929739135c35bcfe1b7
4
- data.tar.gz: 5262a6b3e72274fdabb48b0fdb51a9e4acc8d445
3
+ metadata.gz: 78e884a73503282cda54f49a0bf77a7ededca706
4
+ data.tar.gz: dd61912a721ace8f23fbc75ed473c212db0a4488
5
5
  SHA512:
6
- metadata.gz: 4d54be906d76ad9e6a51653f0425f250015a20fa8eefa7b08cb6b9b3714f893fb8250040c5baae48abec0f37a46f81ce351f16f71d8f266a418ac263a374225f
7
- data.tar.gz: d9002bcd7755455128d4f714af265a1105b6c2485cc26143f5bcb91b8c0a076cd539e1fae51cca60371ab01b77a19f8e524c5834c57822282d231524422e83a4
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
- #File.open('/tmp/thing.txt', 'a') { |file| file.write("\n\n!!!query\n#{sql}") }
29
+ File.open('/tmp/thing.txt', 'a') { |file| file.write("\n!!query\n#{sql}") }
30
30
  query_object = HipsterSqlToHbase.parse_hash(sql)
31
- #File.open('/tmp/thing.txt', 'a') { |file| file.write("\n#{query_object.inspect}") }
31
+ File.open('/tmp/thing.txt', 'a') { |file| file.write("\n#{query_object.inspect}") }
32
32
  begin
33
- #TODO: make these be msgpack instead of json
34
- result = secure_request("/exec", { body: {query: JSON.generate(query_object)} })
35
- Hbase::Result.new(result)
36
- rescue Exception => e
37
- #File.open('/tmp/thing.txt', 'a') { |file| file.write("\n\n!!!error\n#{e.message}") }
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
- #TODO: make these be msgpack instead of json
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
- #TODO: make these be msgpack instead of json
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
@@ -0,0 +1,7 @@
1
+ require 'msgpack'
2
+
3
+ class Time
4
+ def to_msgpack(packer)
5
+ packer.pack self.to_s
6
+ end
7
+ end
@@ -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
- #$LOAD_PATH.unshift '/home/jean/adapter/lib/mysql2/lib'
8
- #require 'mysql2'
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
- ### FOR DEBUGGING ONLY ###
22
- #if Mysql2::Client.const_defined? :FOUND_ROWS
23
- # config[:flags] = Mysql2::Client::FOUND_ROWS
24
- #end
25
- #config[:host] = config[:m2host]
26
- #config[:port] = config[:m2port]
27
- #client = Mysql2::Client.new(config)
28
- ### FOR DEBUGGING ONLY ###
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
@@ -0,0 +1,9 @@
1
+ require 'activerecord-hbase-adapter/version'
2
+ require 'active_record/connection_adapters/hbase_adapter'
3
+
4
+ module Activerecord
5
+ module Hbase
6
+ module Adapter
7
+ end
8
+ end
9
+ end
@@ -1,7 +1,7 @@
1
1
  module Activerecord
2
2
  module Hbase
3
3
  module Adapter
4
- VERSION = "0.0.71"
4
+ VERSION = "0.0.81"
5
5
  end
6
6
  end
7
7
  end
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.71
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-05 00:00:00.000000000 Z
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: []