vertica_rails_adapter 0.0.2 → 0.0.3
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.
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# VerticaRailsAdapter
|
2
2
|
|
3
|
-
|
3
|
+
Vertica adapter for ActiveRecord. This adapter gives you the power of ActiveRecord for your Vertica connection. This adapter uses the [vertica gem](http://github.com/sprsquish/vertica).
|
4
|
+
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -10,7 +11,7 @@ Add this line to your application's Gemfile:
|
|
10
11
|
|
11
12
|
And then execute:
|
12
13
|
|
13
|
-
$ bundle
|
14
|
+
$ bundle install
|
14
15
|
|
15
16
|
Or install it yourself as:
|
16
17
|
|
@@ -18,7 +19,24 @@ Or install it yourself as:
|
|
18
19
|
|
19
20
|
## Usage
|
20
21
|
|
21
|
-
|
22
|
+
Create the basic connection to the vertica database (i.e. app/models/vertica_db.rb):
|
23
|
+
|
24
|
+
module VerticaDb
|
25
|
+
class Base < ActiveRecord::Base
|
26
|
+
establish_connection(Settings[:vertica_prod])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Dir['vertica_db/*.rb'].each { | f | require File.expand_path(f) }
|
31
|
+
|
32
|
+
Create a folder inside app/models/ (i.e. app/models/vertica_db/) and define your models there (users.rb):
|
33
|
+
|
34
|
+
module VerticaDb
|
35
|
+
class Yoda < VerticaDb::Base
|
36
|
+
set_table_name "users"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
22
40
|
|
23
41
|
## Contributing
|
24
42
|
|
@@ -51,21 +51,21 @@ module ActiveRecord
|
|
51
51
|
def self.instantiate(record)
|
52
52
|
record.stringify_keys!
|
53
53
|
|
54
|
-
sti_class = find_sti_class(record[inheritance_column])
|
55
|
-
record_id = sti_class.primary_key && record[sti_class.primary_key]
|
56
|
-
if ActiveRecord::IdentityMap.enabled? && record_id
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
else
|
67
|
-
|
68
|
-
end
|
54
|
+
# sti_class = find_sti_class(record[inheritance_column])
|
55
|
+
# record_id = sti_class.primary_key && record[sti_class.primary_key]
|
56
|
+
# if ActiveRecord::IdentityMap.enabled? && record_id
|
57
|
+
# if (column = sti_class.columns_hash[sti_class.primary_key]) && column.number?
|
58
|
+
# record_id = record_id.to_i
|
59
|
+
# end
|
60
|
+
# if instance = IdentityMap.get(sti_class, record_id)
|
61
|
+
# instance.reinit_with('attributes' => record)
|
62
|
+
# else
|
63
|
+
# instance = sti_class.allocate.init_with('attributes' => record)
|
64
|
+
# IdentityMap.add(instance)
|
65
|
+
# end
|
66
|
+
# else
|
67
|
+
# instance = sti_class.allocate.init_with('attributes' => record)
|
68
|
+
# end
|
69
69
|
|
70
70
|
instance
|
71
71
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vertica_rails_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sasan Padidar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-01-
|
18
|
+
date: 2013-01-26 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|
@@ -33,6 +33,20 @@ dependencies:
|
|
33
33
|
- 0
|
34
34
|
version: 3.0.0
|
35
35
|
requirement: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
type: :runtime
|
38
|
+
name: vertica
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
requirement: *id002
|
36
50
|
description: Vertica Adapter for ActiveRecord.
|
37
51
|
email:
|
38
52
|
- sasan@raybeam.com
|