sequel-vertica 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ 0.1.0
2
+
3
+ * Supports Vertica 6.0
@@ -1,5 +1,5 @@
1
1
  module Sequel
2
2
  module Vertica
3
- VERSION = "0.0.6"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -2,11 +2,26 @@ require 'vertica'
2
2
 
3
3
  module Sequel
4
4
  module Vertica
5
+
6
+ class CreateTableGenerator < Sequel::Schema::CreateTableGenerator
7
+ def primary_key(name, *args)
8
+ super
9
+
10
+ if @primary_key[:auto_increment]
11
+ @primary_key.delete(:auto_increment)
12
+ @primary_key[:type] = Vertica::Database::AUTO_INCREMENT
13
+ end
14
+
15
+ @primary_key
16
+ end
17
+ end
18
+
5
19
  class Database < Sequel::Database
6
20
 
7
21
  ::Vertica::Connection.send(:alias_method,:execute, :query)
8
22
 
9
23
  PK_NAME = 'C_PRIMARY'
24
+ AUTO_INCREMENT = 'AUTO_INCREMENT'
10
25
  set_adapter_scheme :vertica
11
26
 
12
27
  def connect(server)
@@ -63,6 +78,14 @@ module Sequel
63
78
  dataset.from(:v_monitor__locks)
64
79
  end
65
80
 
81
+ def auto_increment_sql
82
+ AUTO_INCREMENT
83
+ end
84
+
85
+ def create_table_generator_class
86
+ Vertica::CreateTableGenerator
87
+ end
88
+
66
89
  def tables(options = {} )
67
90
  schema = options[:schema]
68
91
  filter = {}
@@ -8,14 +8,16 @@ Gem::Specification.new do |gem|
8
8
  gem.summary = %q{Sequel adapter for the Vertica database largely based on the PostgreSQL adapter}
9
9
  gem.homepage = "https://github.com/camilo/sequel-vertica"
10
10
 
11
+ gem.requirements = "Vertica version 6.0 or higher"
12
+
11
13
  gem.add_development_dependency "rspec"
12
14
  gem.add_runtime_dependency "sequel", "~> 3.42.0"
13
- gem.add_runtime_dependency "vertica", "~> 0.9.2"
15
+ gem.add_runtime_dependency "vertica", "~> 0.10.0"
14
16
 
15
17
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
18
  gem.files = `git ls-files`.split("\n")
17
19
  gem.test_files = `git ls-files -- {spec}/*`.split("\n")
18
20
  gem.name = "sequel-vertica"
19
- gem.require_paths = ["lib"]
21
+ gem.require_paths = ["lib"]
20
22
  gem.version = Sequel::Vertica::VERSION
21
23
  end
@@ -45,6 +45,16 @@ describe "A Vertica database" do
45
45
  ]
46
46
  end
47
47
 
48
+ specify "should create an auto incrementing primary key" do
49
+ @db.create_table! :auto_inc_test do
50
+ primary_key :id
51
+ integer :value
52
+ end
53
+ @db[<<-SQL].first[:COUNT].should == 1
54
+ SELECT COUNT(1) FROM v_catalog.sequences WHERE identity_table_name='auto_inc_test'
55
+ SQL
56
+ end
57
+
48
58
  end
49
59
 
50
60
  describe "A vertica dataset" do
@@ -159,37 +169,35 @@ describe "A Vertica database" do
159
169
  @db = VERTICA_DB
160
170
  end
161
171
 
162
- specify "should support column operations" do
163
- @db.create_table!(:test2){varchar :name; integer :value}
164
- @db[:test2] << {}
172
+ specify "should support ALTER TABLE DROP COLUMN" do
173
+ @db.create_table!(:test3) { varchar :name; integer :value }
174
+ @db[:test3].columns.should == [:name, :value]
175
+ @db.drop_column :test3, :value
176
+ @db[:test3].columns.should == [:name]
177
+ end
178
+
179
+ specify "It does not support ALTER TABLE ALTER COLUMN TYPE" do
180
+ @db.create_table!(:test4) { varchar :name; integer :value }
181
+ proc{ @db.set_column_type :test4, :value, :float }.should raise_error(Sequel::DatabaseError,
182
+ /Syntax error at or near "TYPE"/)
183
+ end
184
+
185
+ specify "should support rename column operations" do
186
+ @db.create_table!(:test5) { varchar :name; integer :value }
187
+ @db[:test5] << {:name => 'mmm', :value => 111}
188
+ @db.rename_column :test5, :value, :val
189
+ @db[:test5].columns.should == [:name, :val]
190
+ @db[:test5].first[:val].should == 111
191
+ end
192
+
193
+ specify "should support add column operations" do
194
+ @db.create_table!(:test2) { varchar :name; integer :value }
165
195
  @db[:test2].columns.should == [:name, :value]
166
196
 
167
197
  @db.add_column :test2, :xyz, :varchar, :default => '000'
168
198
  @db[:test2].columns.should == [:name, :value, :xyz]
169
199
  @db[:test2] << {:name => 'mmm', :value => 111}
170
200
  @db[:test2].first[:xyz].should == '000'
171
-
172
- @db[:test2].columns.should == [:name, :value, :xyz]
173
- proc{ @db.drop_column :test2, :xyz }.should raise_error(Sequel::DatabaseError,
174
- /ALTER TABLE DROP COLUMN not supported/)
175
-
176
- @db[:test2].columns.should ==[:name, :value, :xyz]
177
-
178
- @db[:test2].delete
179
- @db.add_column :test2, :xyz2, :varchar, :default => '000'
180
- @db[:test2] << {:name => 'mmm', :value => 111, :xyz2 => 'qqqq'}
181
-
182
- @db[:test2].columns.should == [:name, :value, :xyz, :xyz2]
183
- @db.rename_column :test2, :xyz, :zyx
184
- @db[:test2].columns.should == [:name, :value, :zyx, :xyz2]
185
- @db[:test2].first[:xyz2].should == 'qqqq'
186
-
187
- @db.add_column :test2, :xyz, :float
188
- @db[:test2].delete
189
- @db[:test2] << {:name => 'mmm', :value => 111, :xyz => 56.78}
190
-
191
- proc{ @db.set_column_type :test2, :xyz, :integer }.should raise_error(Sequel::DatabaseError,
192
- /ALTER TABLE ALTER COLUMN not supported/)
193
201
  end
194
202
 
195
203
  specify "#locks should be a dataset returning database locks " do
@@ -1 +1 @@
1
- VERTICA_URL = 'vertica://dbadmin:@192.168.56.101:5433/warehouse'
1
+ VERTICA_URL = 'vertica://dbadmin:@127.0.0.1:5433/warehouse'
metadata CHANGED
@@ -1,49 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-vertica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
5
4
  prerelease:
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Camilo Lopez
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-18 00:00:00.000000000Z
12
+ date: 2013-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ prerelease: false
15
16
  name: rspec
16
- requirement: &70143867804000 !ruby/object:Gem::Requirement
17
+ type: :development
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
17
23
  none: false
24
+ requirement: !ruby/object:Gem::Requirement
18
25
  requirements:
19
26
  - - ! '>='
20
27
  - !ruby/object:Gem::Version
21
28
  version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: *70143867804000
29
+ none: false
25
30
  - !ruby/object:Gem::Dependency
31
+ prerelease: false
26
32
  name: sequel
27
- requirement: &70143867803160 !ruby/object:Gem::Requirement
33
+ type: :runtime
34
+ version_requirements: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: 3.42.0
28
39
  none: false
40
+ requirement: !ruby/object:Gem::Requirement
29
41
  requirements:
30
42
  - - ~>
31
43
  - !ruby/object:Gem::Version
32
44
  version: 3.42.0
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *70143867803160
45
+ none: false
36
46
  - !ruby/object:Gem::Dependency
47
+ prerelease: false
37
48
  name: vertica
38
- requirement: &70143867802220 !ruby/object:Gem::Requirement
49
+ type: :runtime
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.10.0
39
55
  none: false
56
+ requirement: !ruby/object:Gem::Requirement
40
57
  requirements:
41
58
  - - ~>
42
59
  - !ruby/object:Gem::Version
43
- version: 0.9.2
44
- type: :runtime
45
- prerelease: false
46
- version_requirements: *70143867802220
60
+ version: 0.10.0
61
+ none: false
47
62
  description: Sequel adapter for the Vertica database
48
63
  email:
49
64
  - camilo@camilolopez.com
@@ -52,6 +67,7 @@ extensions: []
52
67
  extra_rdoc_files: []
53
68
  files:
54
69
  - .gitignore
70
+ - CHANGELOG
55
71
  - Gemfile
56
72
  - Rakefile
57
73
  - Readme.md
@@ -70,26 +86,27 @@ rdoc_options: []
70
86
  require_paths:
71
87
  - lib
72
88
  required_ruby_version: !ruby/object:Gem::Requirement
73
- none: false
74
89
  requirements:
75
90
  - - ! '>='
76
91
  - !ruby/object:Gem::Version
77
- version: '0'
78
92
  segments:
79
93
  - 0
80
- hash: 325789852756390842
81
- required_rubygems_version: !ruby/object:Gem::Requirement
94
+ hash: 2330074690303578723
95
+ version: '0'
82
96
  none: false
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
98
  requirements:
84
99
  - - ! '>='
85
100
  - !ruby/object:Gem::Version
86
- version: '0'
87
101
  segments:
88
102
  - 0
89
- hash: 325789852756390842
90
- requirements: []
103
+ hash: 2330074690303578723
104
+ version: '0'
105
+ none: false
106
+ requirements:
107
+ - Vertica version 6.0 or higher
91
108
  rubyforge_project:
92
- rubygems_version: 1.8.10
109
+ rubygems_version: 1.8.23
93
110
  signing_key:
94
111
  specification_version: 3
95
112
  summary: Sequel adapter for the Vertica database largely based on the PostgreSQL adapter