sequel-vertica 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 224357ab7df2bccbf853e1a34c7bc5f6b1c89ebb
4
- data.tar.gz: 2480bc67b31e77b8291d2fa3198f8c0bbe1bc074
3
+ metadata.gz: ce96b243358a0d65c1f5006e89a999af0570b724
4
+ data.tar.gz: 47759596fb816ecb87a37fc12088f942cf6cdd56
5
5
  SHA512:
6
- metadata.gz: 2e5f8fd7028e06c8d0e7e5d78eb60a237f490adff29fea5dff4c42e718f614e50a666c83d02c8bb049130c60b62a16784e12cbfbc694427663e1bea0b5d742ab
7
- data.tar.gz: 672e91d04cd326dfa20f961f268a675381565a44a6cc44ea6b260c83983924143fe3b7b37ec3207f47c277809a3e5618e9118b77c9e17913d616aaf35482bcc0
6
+ metadata.gz: 514ad89b3cdfd3594ae26498c8056a4da13b434fcdad5780277353a294246dc3edf1886d80deeabe40f8904c259a966a226652216548f87cfca2681fe88ddb35
7
+ data.tar.gz: 767a0c5e52ad27832eb35c508589d279838c3bc6756a907b5a4959d13b03eb54f7199f0d3db15de9fae856b919ba8f6270bf7703b743d8d4214d1cf83685470e
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  spec/spec_config.rb
19
19
  .rbenv-version
20
+ vendor/
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ 0.2.1
2
+
3
+ * Update sequel depenency
4
+ * Add support for read_timeout option
5
+
6
+ 0.2.0
7
+
8
+ * Update vertica gem depenency
9
+ * Update sequel gem depenency
10
+ * Enable CI
11
+
1
12
  0.1.0
2
13
 
3
14
  * Supports Vertica 6.0
@@ -1,5 +1,5 @@
1
1
  module Sequel
2
2
  module Vertica
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -34,7 +34,8 @@ module Sequel
34
34
  :port => opts[:port],
35
35
  :schema => opts[:schema],
36
36
  :database => opts[:database],
37
- :ssl => opts[:ssl]
37
+ :read_timeout => opts[:read_timeout].nil? ? nil : opts[:read_timeout].to_i,
38
+ :ssl => opts[:ssl]
38
39
  )
39
40
  end
40
41
 
@@ -15,15 +15,15 @@ Gem::Specification.new do |gem|
15
15
  gem.requirements = "Vertica version 6.0 or higher"
16
16
  gem.required_ruby_version = '>= 1.9.3'
17
17
 
18
- gem.add_runtime_dependency "sequel", "~> 4.9.0"
19
- gem.add_runtime_dependency "vertica", "~> 0.11.0"
18
+ gem.add_runtime_dependency "sequel", "~> 4.14"
19
+ gem.add_runtime_dependency "vertica", "~> 0.11.1"
20
20
 
21
21
  gem.add_development_dependency "rake", ">= 10"
22
- gem.add_development_dependency "rspec" , "~> 2.14"
22
+ gem.add_development_dependency "rspec" , "~> 3.1"
23
23
 
24
24
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
25
  gem.files = `git ls-files`.split("\n")
26
26
  gem.test_files = `git ls-files -- {spec}/*`.split("\n")
27
-
27
+
28
28
  gem.require_paths = ["lib"]
29
29
  end
@@ -28,6 +28,15 @@ VERTICA_DB.create_table! :test4 do
28
28
  bytea :value
29
29
  end
30
30
 
31
+ describe "A vertica sequel connection" do
32
+ specify "should set a read timeout" do
33
+ conn = Sequel.connect("#{ENV['SEQUEL_VERTICA_SPEC_DB']||VERTICA_URL}?read_timeout=1000")
34
+ conn.synchronize do |raw_conn|
35
+ expect(raw_conn.options[:read_timeout]).to eq(1000)
36
+ end
37
+ end
38
+ end
39
+
31
40
  describe "A Vertica database" do
32
41
 
33
42
  before do
@@ -35,14 +44,14 @@ describe "A Vertica database" do
35
44
  end
36
45
 
37
46
  specify "should correctly parse the schema" do
38
- @db.schema(:test3, :reload=>true).should == [
47
+ expect(@db.schema(:test3, :reload=>true)).to eq([
39
48
  [:value, {:type=>:integer, :allow_null=>true, :default=>nil, :ruby_default=>nil, :db_type=>"int", :primary_key=>false}],
40
49
  [:time, {:type=>:datetime, :allow_null=>true, :default=>nil, :ruby_default=>nil, :db_type=>"timestamp", :primary_key=>false}]
41
- ]
42
- @db.schema(:test4, :reload=>true).should == [
43
- [:name, {:type=>:string, :allow_null=>true, :default=>nil, :ruby_default=>nil, :db_type=>"varchar(20)", :primary_key=>false}],
44
- [:value, {:type=>:blob, :allow_null=>true, :default=>nil, :ruby_default=>nil, :db_type=>"varbinary(80)", :primary_key=>false}]
45
- ]
50
+ ])
51
+ expect(@db.schema(:test4, :reload=>true)).to eq([
52
+ [:name, {:allow_null=>true, :default=>nil, :db_type=>"varchar(20)", :type=>:string, :primary_key=>false, :ruby_default=>nil, :max_length=>20}],
53
+ [:value, {:allow_null=>true, :default=>nil, :db_type=>"varbinary(80)", :type=>:blob, :primary_key=>false, :ruby_default=>nil}]
54
+ ])
46
55
  end
47
56
 
48
57
  specify "should create an auto incrementing primary key" do
@@ -50,7 +59,7 @@ describe "A Vertica database" do
50
59
  primary_key :id
51
60
  integer :value
52
61
  end
53
- @db[<<-SQL].first[:COUNT].should == 1
62
+ expect(@db[<<-SQL].first[:COUNT]).to eq(1)
54
63
  SELECT COUNT(1) FROM v_catalog.sequences WHERE identity_table_name='auto_inc_test'
55
64
  SQL
56
65
  end
@@ -64,63 +73,77 @@ describe "A vertica dataset" do
64
73
  end
65
74
 
66
75
  specify "should quote columns and tables using double quotes if quoting identifiers" do
67
- @d.select(:name).sql.should == \
76
+ expect(@d.select(:name).sql).to eq( \
68
77
  'SELECT "name" FROM "test"'
78
+ )
69
79
 
70
- @d.select(Sequel.lit('COUNT(*)')).sql.should == \
80
+ expect(@d.select(Sequel.lit('COUNT(*)')).sql).to eq( \
71
81
  'SELECT COUNT(*) FROM "test"'
82
+ )
72
83
 
73
- @d.select(:max.sql_function(:value)).sql.should == \
84
+ expect(@d.select(:max.sql_function(:value)).sql).to eq( \
74
85
  'SELECT max("value") FROM "test"'
86
+ )
75
87
 
76
- @d.select(:NOW.sql_function).sql.should == \
88
+ expect(@d.select(:NOW.sql_function).sql).to eq( \
77
89
  'SELECT NOW() FROM "test"'
90
+ )
78
91
 
79
- @d.select(:max.sql_function(:items__value)).sql.should == \
92
+ expect(@d.select(:max.sql_function(:items__value)).sql).to eq( \
80
93
  'SELECT max("items"."value") FROM "test"'
94
+ )
81
95
 
82
- @d.order(:name.desc).sql.should == \
96
+ expect(@d.order(:name.desc).sql).to eq( \
83
97
  'SELECT * FROM "test" ORDER BY "name" DESC'
98
+ )
84
99
 
85
- @d.select(Sequel.lit('test.name AS item_name')).sql.should == \
100
+ expect(@d.select(Sequel.lit('test.name AS item_name')).sql).to eq( \
86
101
  'SELECT test.name AS item_name FROM "test"'
102
+ )
87
103
 
88
- @d.select(Sequel.lit('"name"')).sql.should == \
104
+ expect(@d.select(Sequel.lit('"name"')).sql).to eq( \
89
105
  'SELECT "name" FROM "test"'
106
+ )
90
107
 
91
- @d.select(Sequel.lit('max(test."name") AS "max_name"')).sql.should == \
108
+ expect(@d.select(Sequel.lit('max(test."name") AS "max_name"')).sql).to eq( \
92
109
  'SELECT max(test."name") AS "max_name" FROM "test"'
110
+ )
93
111
 
94
- @d.insert_sql(:x => :y).should =~ \
112
+ expect(@d.insert_sql(:x => :y)).to match( \
95
113
  /\AINSERT INTO "test" \("x"\) VALUES \("y"\)( RETURNING NULL)?\z/
114
+ )
96
115
 
97
116
  end
98
117
 
99
118
  specify "should quote fields correctly when reversing the order if quoting identifiers" do
100
- @d.reverse_order(:name).sql.should == \
119
+ expect(@d.reverse_order(:name).sql).to eq( \
101
120
  'SELECT * FROM "test" ORDER BY "name" DESC'
121
+ )
102
122
 
103
- @d.reverse_order(:name.desc).sql.should == \
123
+ expect(@d.reverse_order(:name.desc).sql).to eq( \
104
124
  'SELECT * FROM "test" ORDER BY "name" ASC'
125
+ )
105
126
 
106
- @d.reverse_order(:name, :test.desc).sql.should == \
127
+ expect(@d.reverse_order(:name, :test.desc).sql).to eq( \
107
128
  'SELECT * FROM "test" ORDER BY "name" DESC, "test" ASC'
129
+ )
108
130
 
109
- @d.reverse_order(:name.desc, :test).sql.should == \
131
+ expect(@d.reverse_order(:name.desc, :test).sql).to eq( \
110
132
  'SELECT * FROM "test" ORDER BY "name" ASC, "test" DESC'
133
+ )
111
134
  end
112
135
 
113
136
  specify "should support regexps" do
114
137
  @d << {:name => 'abc', :value => 1}
115
138
  @d << {:name => 'bcd', :value => 2}
116
139
 
117
- @d.filter(:name => /bc/).count.should == 2
118
- @d.filter(:name => /^bc/).count.should == 1
140
+ expect(@d.filter(:name => /bc/).count).to eq(2)
141
+ expect(@d.filter(:name => /^bc/).count).to eq(1)
119
142
  end
120
143
 
121
144
  specify "#columns should return the correct column names" do
122
- @d.columns!.should == [:name, :value]
123
- @d.select(:name).columns!.should == [:name]
145
+ expect(@d.columns!).to eq([:name, :value])
146
+ expect(@d.select(:name).columns!).to eq([:name])
124
147
  end
125
148
  end
126
149
 
@@ -139,25 +162,25 @@ describe "A Vertica dataset with a timestamp field" do
139
162
  t = Time.now
140
163
  @d << {:value=>1, :time=>t}
141
164
  t2 = @d[:value =>1][:time]
142
- @d.literal(t2).should == @d.literal(t)
143
- t2.strftime('%Y-%m-%d %H:%M:%S').should == t.strftime('%Y-%m-%d %H:%M:%S')
144
- (t2.is_a?(Time) ? t2.usec : t2.strftime('%N').to_i/1000).should == t.usec
165
+ expect(@d.literal(t2)).to eq(@d.literal(t))
166
+ expect(t2.strftime('%Y-%m-%d %H:%M:%S')).to eq(t.strftime('%Y-%m-%d %H:%M:%S'))
167
+ expect(t2.is_a?(Time) ? t2.usec : t2.strftime('%N').to_i/1000).to eq(t.usec)
145
168
  end
146
169
 
147
170
  cspecify "should store milliseconds in time fields for DateTime objects", :do, :swift do
148
171
  t = DateTime.now
149
172
  @d << {:value=>1, :time=>t}
150
173
  t2 = @d[:value =>1][:time]
151
- @d.literal(t2).should == @d.literal(t)
152
- t2.strftime('%Y-%m-%d %H:%M:%S').should == t.strftime('%Y-%m-%d %H:%M:%S')
153
- (t2.is_a?(Time) ? t2.usec : t2.strftime('%N').to_i/1000).should == t.strftime('%N').to_i/1000
174
+ expect(@d.literal(t2)).to eq(@d.literal(t))
175
+ expect(t2.strftime('%Y-%m-%d %H:%M:%S')).to eq(t.strftime('%Y-%m-%d %H:%M:%S'))
176
+ expect(t2.is_a?(Time) ? t2.usec : t2.strftime('%N').to_i/1000).to eq(t.strftime('%N').to_i/1000)
154
177
  end
155
178
 
156
179
  describe "Verticas's EXPLAIN and EXPLAIN LOCAL" do
157
180
  specify "should not raise errors" do
158
181
  @d = VERTICA_DB[:test3]
159
- proc{@d.explain}.should_not raise_error
160
- proc{@d.explain(:local => true)}.should_not raise_error
182
+ expect{@d.explain}.not_to raise_error
183
+ expect{@d.explain(:local => true)}.not_to raise_error
161
184
  end
162
185
  end
163
186
 
@@ -171,14 +194,14 @@ describe "A Vertica database" do
171
194
 
172
195
  specify "should support ALTER TABLE DROP COLUMN" do
173
196
  @db.create_table!(:test3) { varchar :name; integer :value }
174
- @db[:test3].columns.should == [:name, :value]
197
+ expect(@db[:test3].columns).to eq([:name, :value])
175
198
  @db.drop_column :test3, :value
176
- @db[:test3].columns.should == [:name]
199
+ expect(@db[:test3].columns).to eq([:name])
177
200
  end
178
201
 
179
202
  specify "It does not support ALTER TABLE ALTER COLUMN TYPE" do
180
203
  @db.create_table!(:test4) { varchar :name; integer :value }
181
- proc{ @db.set_column_type :test4, :value, :float }.should raise_error(Sequel::DatabaseError,
204
+ expect{ @db.set_column_type :test4, :value, :float }.to raise_error(Sequel::DatabaseError,
182
205
  /Syntax error at or near "TYPE"/)
183
206
  end
184
207
 
@@ -186,23 +209,23 @@ describe "A Vertica database" do
186
209
  @db.create_table!(:test5) { varchar :name; integer :value }
187
210
  @db[:test5] << {:name => 'mmm', :value => 111}
188
211
  @db.rename_column :test5, :value, :val
189
- @db[:test5].columns.should == [:name, :val]
190
- @db[:test5].first[:val].should == 111
212
+ expect(@db[:test5].columns).to eq([:name, :val])
213
+ expect(@db[:test5].first[:val]).to eq(111)
191
214
  end
192
215
 
193
216
  specify "should support add column operations" do
194
217
  @db.create_table!(:test2) { varchar :name; integer :value }
195
- @db[:test2].columns.should == [:name, :value]
218
+ expect(@db[:test2].columns).to eq([:name, :value])
196
219
 
197
220
  @db.add_column :test2, :xyz, :varchar, :default => '000'
198
- @db[:test2].columns.should == [:name, :value, :xyz]
221
+ expect(@db[:test2].columns).to eq([:name, :value, :xyz])
199
222
  @db[:test2] << {:name => 'mmm', :value => 111}
200
- @db[:test2].first[:xyz].should == '000'
223
+ expect(@db[:test2].first[:xyz]).to eq('000')
201
224
  end
202
225
 
203
226
  specify "#locks should be a dataset returning database locks " do
204
- @db.locks.should be_a_kind_of(Sequel::Dataset)
205
- @db.locks.all.should be_a_kind_of(Array)
227
+ expect(@db.locks).to be_a_kind_of(Sequel::Dataset)
228
+ expect(@db.locks.all).to be_a_kind_of(Array)
206
229
  end
207
230
  end
208
231
 
@@ -219,14 +242,14 @@ describe "Vertica::Dataset#insert" do
219
242
  end
220
243
 
221
244
  specify "should work with static SQL" do
222
- @ds.with_sql('INSERT INTO test5 (value) VALUES (10)').insert.should == 1
223
- @db['INSERT INTO test5 (value) VALUES (20)'].insert.should == 1
224
- @ds.all.should == [{:value=>10}, {:value=>20}]
245
+ expect(@ds.with_sql('INSERT INTO test5 (value) VALUES (10)').insert).to eq(1)
246
+ expect(@db['INSERT INTO test5 (value) VALUES (20)'].insert).to eq(1)
247
+ expect(@ds.all).to include({:value=>10}, {:value=>20})
225
248
  end
226
249
 
227
250
  specify "should insert correctly if using a column array and a value array" do
228
- @ds.insert([:value], [10]).should == 1
229
- @ds.all.should == [{:value=>10}]
251
+ expect(@ds.insert([:value], [10])).to eq(1)
252
+ expect(@ds.all).to eq([{:value=>10}])
230
253
  end
231
254
  end
232
255
 
@@ -243,37 +266,37 @@ describe "Vertica::Database schema qualified tables" do
243
266
 
244
267
  specify "should be able to create, drop, select and insert into tables in a given schema" do
245
268
  VERTICA_DB.create_table(:schema_test__table_in_schema_test){integer :i}
246
- VERTICA_DB[:schema_test__table_in_schema_test].first.should == nil
247
- VERTICA_DB[:schema_test__table_in_schema_test].insert(:i=>1).should == 1
248
- VERTICA_DB[:schema_test__table_in_schema_test].first.should == {:i=>1}
249
- VERTICA_DB.from(Sequel.lit('schema_test.table_in_schema_test')).first.should == {:i=>1}
269
+ expect(VERTICA_DB[:schema_test__table_in_schema_test].first).to eq(nil)
270
+ expect(VERTICA_DB[:schema_test__table_in_schema_test].insert(:i=>1)).to eq(1)
271
+ expect(VERTICA_DB[:schema_test__table_in_schema_test].first).to eq({:i=>1})
272
+ expect(VERTICA_DB.from(Sequel.lit('schema_test.table_in_schema_test')).first).to eq({:i=>1})
250
273
  VERTICA_DB.drop_table(:schema_test__table_in_schema_test)
251
274
  VERTICA_DB.create_table(:table_in_schema_test.qualify(:schema_test)){integer :i}
252
- VERTICA_DB[:schema_test__table_in_schema_test].first.should == nil
253
- VERTICA_DB.from(Sequel.lit('schema_test.table_in_schema_test')).first.should == nil
275
+ expect(VERTICA_DB[:schema_test__table_in_schema_test].first).to eq(nil)
276
+ expect(VERTICA_DB.from(Sequel.lit('schema_test.table_in_schema_test')).first).to eq(nil)
254
277
  VERTICA_DB.drop_table(:table_in_schema_test.qualify(:schema_test))
255
278
  end
256
279
 
257
280
  specify "#tables should not include tables in a default non-public schema" do
258
281
  VERTICA_DB.create_table(:schema_test__table_in_schema_test){integer :i}
259
- VERTICA_DB.tables.should include(:table_in_schema_test)
260
- VERTICA_DB.tables.should_not include(:tables)
261
- VERTICA_DB.tables.should_not include(:columns)
262
- VERTICA_DB.tables.should_not include(:locks)
263
- VERTICA_DB.tables.should_not include(:domain_udt_usage)
282
+ expect(VERTICA_DB.tables).to include(:table_in_schema_test)
283
+ expect(VERTICA_DB.tables).not_to include(:tables)
284
+ expect(VERTICA_DB.tables).not_to include(:columns)
285
+ expect(VERTICA_DB.tables).not_to include(:locks)
286
+ expect(VERTICA_DB.tables).not_to include(:domain_udt_usage)
264
287
  end
265
288
 
266
289
  specify "#tables should return tables in the schema provided by the :schema argument" do
267
290
  VERTICA_DB.create_table(:schema_test__table_in_schema_test){integer :i}
268
- VERTICA_DB.tables(:schema=>:schema_test).should == [:table_in_schema_test]
291
+ expect(VERTICA_DB.tables(:schema=>:schema_test)).to eq([:table_in_schema_test])
269
292
  end
270
293
 
271
294
  specify "#schema should not include columns from tables in a default non-public schema" do
272
295
  VERTICA_DB.create_table(:schema_test__domains){integer :i}
273
296
  sch = VERTICA_DB.schema(:domains)
274
297
  cs = sch.map{|x| x.first}
275
- cs.should include(:i)
276
- cs.should_not include(:data_type)
298
+ expect(cs).to include(:i)
299
+ expect(cs).not_to include(:data_type)
277
300
  end
278
301
 
279
302
  specify "#schema should only include columns from the table in the given :schema argument" do
@@ -281,14 +304,14 @@ describe "Vertica::Database schema qualified tables" do
281
304
  VERTICA_DB.create_table(:schema_test__domains){integer :i}
282
305
  sch = VERTICA_DB.schema(:domains, :schema=>:schema_test)
283
306
  cs = sch.map{|x| x.first}
284
- cs.should include(:i)
285
- cs.should_not include(:d)
307
+ expect(cs).to include(:i)
308
+ expect(cs).not_to include(:d)
286
309
  VERTICA_DB.drop_table(:domains)
287
310
  end
288
311
 
289
312
  specify "#table_exists? should see if the table is in a given schema" do
290
313
  VERTICA_DB.create_table(:schema_test__schema_test){integer :i}
291
- VERTICA_DB.table_exists?(:schema_test__schema_test).should == true
314
+ expect(VERTICA_DB.table_exists?(:schema_test__schema_test)).to eq(true)
292
315
  end
293
316
 
294
317
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-vertica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camilo Lopez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-14 00:00:00.000000000 Z
11
+ date: 2014-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 4.9.0
19
+ version: '4.14'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 4.9.0
26
+ version: '4.14'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: vertica
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.11.0
33
+ version: 0.11.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 0.11.0
40
+ version: 0.11.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '2.14'
61
+ version: '3.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '2.14'
68
+ version: '3.1'
69
69
  description: Sequel adapter for the Vertica database
70
70
  email:
71
71
  - camilo@camilolopez.com
@@ -113,4 +113,3 @@ signing_key:
113
113
  specification_version: 4
114
114
  summary: Sequel adapter for the Vertica database largely based on the PostgreSQL adapter
115
115
  test_files: []
116
- has_rdoc: