sequel-vertica 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sequel-vertica/version.rb +1 -1
- data/lib/sequel/adapters/vertica.rb +13 -3
- data/sequel-vertica.gemspec +1 -1
- data/spec/adapters/vertica_spec.rb +4 -1
- metadata +10 -10
@@ -20,10 +20,12 @@ module Sequel
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def execute(sql, opts = {}, &block)
|
23
|
+
res = nil
|
23
24
|
synchronize(opts[:server]) do |conn|
|
24
25
|
res = conn.query(sql)
|
25
26
|
res.each(&block)
|
26
27
|
end
|
28
|
+
res
|
27
29
|
rescue ::Vertica::Error => e
|
28
30
|
raise_error(e)
|
29
31
|
end
|
@@ -76,7 +78,7 @@ module Sequel
|
|
76
78
|
selector = [:column_name, :constraint_name, :is_nullable.as(:allow_null),
|
77
79
|
(:column_default).as(:default), (:data_type).as(:db_type)]
|
78
80
|
filter = { :table_name => table_name }
|
79
|
-
filter
|
81
|
+
filter[:table_schema] = schema.to_s if schema
|
80
82
|
|
81
83
|
dataset = metadata_dataset.select(*selector).filter(filter).
|
82
84
|
from(:v_catalog__columns).left_outer_join(:v_catalog__table_constraints, :table_id => :table_id)
|
@@ -97,9 +99,17 @@ module Sequel
|
|
97
99
|
EXPLAIN_LOCAL = 'EXPLAIN LOCAL '
|
98
100
|
QUERY_PLAN = 'QUERY PLAN'
|
99
101
|
|
102
|
+
def columns
|
103
|
+
return @columns if @columns
|
104
|
+
ds = unfiltered.unordered.clone(:distinct => nil, :limit => 0, :offset=>nil)
|
105
|
+
res = @db.execute(ds.select_sql)
|
106
|
+
@columns = res.columns.map { |c| c.name }
|
107
|
+
@columns
|
108
|
+
end
|
109
|
+
|
110
|
+
|
100
111
|
def fetch_rows(sql)
|
101
|
-
execute(sql) do
|
102
|
-
@columns ||= row.keys
|
112
|
+
execute(sql) do |row|
|
103
113
|
yield row
|
104
114
|
end
|
105
115
|
end
|
data/sequel-vertica.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.homepage = "https://github.com/camilo/sequel-vertica"
|
10
10
|
|
11
11
|
gem.add_development_dependency "rspec"
|
12
|
-
gem.add_runtime_dependency "sequel", "~> 3.
|
12
|
+
gem.add_runtime_dependency "sequel", "~> 3.37.0"
|
13
13
|
gem.add_runtime_dependency "vertica", "~> 0.9.1"
|
14
14
|
|
15
15
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -108,6 +108,10 @@ describe "A vertica dataset" do
|
|
108
108
|
@d.filter(:name => /^bc/).count.should == 1
|
109
109
|
end
|
110
110
|
|
111
|
+
specify "#columns should return the correct column names" do
|
112
|
+
@d.columns!.should == [:name, :value]
|
113
|
+
@d.select(:name).columns!.should == [:name]
|
114
|
+
end
|
111
115
|
end
|
112
116
|
|
113
117
|
|
@@ -275,7 +279,6 @@ describe "Vertica::Database schema qualified tables" do
|
|
275
279
|
VERTICA_DB.drop_table(:domains)
|
276
280
|
end
|
277
281
|
|
278
|
-
|
279
282
|
specify "#table_exists? should see if the table is in a given schema" do
|
280
283
|
VERTICA_DB.create_table(:schema_test__schema_test){integer :i}
|
281
284
|
VERTICA_DB.table_exists?(:schema_test__schema_test).should == true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-vertica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-26 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70288174048380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70288174048380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sequel
|
27
|
-
requirement: &
|
27
|
+
requirement: &70288174047880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.
|
32
|
+
version: 3.37.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70288174047880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: vertica
|
38
|
-
requirement: &
|
38
|
+
requirement: &70288174047380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 0.9.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70288174047380
|
47
47
|
description: Sequel adapter for the Vertica database
|
48
48
|
email:
|
49
49
|
- camilo@camilolopez.com
|
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
segments:
|
79
79
|
- 0
|
80
|
-
hash:
|
80
|
+
hash: 3211600729631246486
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
none: false
|
83
83
|
requirements:
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
segments:
|
88
88
|
- 0
|
89
|
-
hash:
|
89
|
+
hash: 3211600729631246486
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
92
|
rubygems_version: 1.8.10
|