vertica 0.11.1 → 0.11.2
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 +5 -13
- data/.travis.yml +21 -0
- data/README.md +36 -34
- data/lib/vertica/connection.rb +2 -1
- data/lib/vertica/version.rb +2 -2
- data/test/connection.yml.example +4 -4
- data/test/functional/connection_test.rb +4 -4
- metadata +10 -10
- data/.infinity_test +0 -8
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YzdlZWQ5ZDYxNzU5YTVmYzUzM2EzZWM3OWUxYWMxOGY5ZDBiNjBhYw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fc7668bddfe22ffba6fa8c1e23a8d2805f15e37a
|
4
|
+
data.tar.gz: d6b893a3d25d6f74dc25be57b86dbc58096e9433
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YmQ3NTBjNGQ5MDQxY2FmZjA0MTQxZTU0NDBkZjI2YjQwYmQzMjZmOThhMTAz
|
11
|
-
MzYwM2FiYTRmNWY3NjdiMDhmZTVjYWJiM2ZjYTVmNTU0ZjhhYzg=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ODQ4NzNlZWVhMDAwODNiNmNlNzdiY2I5ZjBiNGM5ODM2MmYxMjM2Yjg4ZDM2
|
14
|
-
NmNmMzBlYTI4MDRlM2Q0NzU2MzQ0ZThlMTZmMjNmZWJiMjk5NTMxNDljZmI0
|
15
|
-
YTNhZjU3YmYzNTJkNjlhNzQwNjUyNGQzZTUyY2YyMWZlYjkxNzY=
|
6
|
+
metadata.gz: 9a4dd5910ad3cc49246beae9c23b984ec415b16e5ba93a3d45103a34b157996262bc8eef5e0a2c934984c627665bf9071dfc801a41c9062227caa6401c02b719
|
7
|
+
data.tar.gz: 544ff2cc5e3aa346c9b35c92a20f23a1aa2d7cb040376720e9627b0a63287e6efdc82abce17b24ee371488fdec4d7ba12080f0d8789f2cb4be913e47f8cc2d6b
|
data/.travis.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.9.3
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.1
|
6
|
+
|
7
|
+
before_install:
|
8
|
+
- sudo wget -nv https://s3.amazonaws.com/circle-support-bucket/vertica_7.0.1-0_amd64.deb
|
9
|
+
- sudo dpkg -i vertica_7.0.1-0_amd64.deb
|
10
|
+
- sudo /opt/vertica/sbin/install_vertica --failure-threshold HALT --accept-eula --dba-user-password dbadmin --license CE -s localhost
|
11
|
+
- sudo -u dbadmin /opt/vertica/bin/adminTools -t create_db --database ci -s localhost -p dbadmin
|
12
|
+
- sudo -u dbadmin openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /home/dbadmin/ci/v_ci_node0001_catalog/server.key -out /home/dbadmin/ci/v_ci_node0001_catalog/server.crt -batch
|
13
|
+
- sudo -u dbadmin chmod 600 /home/dbadmin/ci/v_ci_node0001_catalog/server.key /home/dbadmin/ci/v_ci_node0001_catalog/server.crt
|
14
|
+
- sudo -u dbadmin /opt/vertica/bin/adminTools -t stop_db --database ci -p dbadmin
|
15
|
+
- sudo -u dbadmin sh -c 'echo "EnableSSL = 1" > /home/dbadmin/ci/v_ci_node0001_catalog/vertica.conf'
|
16
|
+
- sudo -u dbadmin /opt/vertica/bin/adminTools -t start_db --database ci -p dbadmin
|
17
|
+
|
18
|
+
before_script:
|
19
|
+
- cp ./test/connection.yml.example ./test/connection.yml
|
20
|
+
|
21
|
+
sudo: false
|
data/README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
# Vertica
|
1
|
+
# Vertica [](https://travis-ci.org/wvanbergen/vertica)
|
2
2
|
|
3
3
|
Vertica is a pure Ruby library for connecting to Vertica databases. You can learn more
|
4
4
|
about Vertica at http://www.vertica.com.
|
5
5
|
|
6
|
-
- Connecting, including over SSL
|
6
|
+
- Connecting, including over SSL.
|
7
7
|
- Executing queries, with results as streaming rows or buffered resultsets.
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- `COPY table FROM STDIN` statement to load data from your application.
|
9
|
+
- Confirmed to work with Ruby 1.9, 2.0, and 2.1 and with Vertica version 6.x,
|
10
|
+
and 7.x.
|
11
|
+
- The library is thread-safe as of version 0.11. However, you can only run one
|
11
12
|
statement at the time per connection, because the protocol is stateful.
|
12
13
|
|
13
14
|
|
@@ -18,21 +19,21 @@ about Vertica at http://www.vertica.com.
|
|
18
19
|
Or add it to your Gemfile:
|
19
20
|
|
20
21
|
gem 'vertica'
|
21
|
-
# gem 'vertica', git: 'git://github.com/
|
22
|
+
# gem 'vertica', git: 'git://github.com/wvanbergen/vertica.git' # HEAD version
|
22
23
|
|
23
24
|
### Compatiblity
|
24
25
|
|
25
26
|
- Ruby 1.8 is no longer supported, but version 0.9.x should still support it.
|
26
|
-
- Vertica versions 4.
|
27
|
-
compatibility is no longer tested. It probably still works as the protocol hasn't
|
28
|
-
changed.
|
27
|
+
- Vertica versions 4.x, and 5.x worked with at some point with this gem, but
|
28
|
+
compatibility is no longer tested. It probably still works as the protocol hasn't
|
29
|
+
changed as far as I am aware.
|
29
30
|
|
30
31
|
|
31
32
|
## Usage
|
32
33
|
|
33
34
|
### Connecting
|
34
35
|
|
35
|
-
The <code>Vertica.connect</code> methods takes a connection parameter hash and returns a
|
36
|
+
The <code>Vertica.connect</code> methods takes a connection parameter hash and returns a
|
36
37
|
connection object. For most options, the gem will use a default value if no value is provided.
|
37
38
|
|
38
39
|
connection = Vertica.connect({
|
@@ -46,12 +47,14 @@ connection object. For most options, the gem will use a default value if no valu
|
|
46
47
|
# :search_path => nil, # default: <user>,public,v_catalog
|
47
48
|
# :row_style => :hash # can also be :array (see below)
|
48
49
|
})
|
49
|
-
|
50
|
+
|
50
51
|
To close the connection when you're done with it, run <code>connection.close</code>.
|
51
52
|
|
53
|
+
You can pass `OpenSSL::SSL::SSLContext` in `:ssl` to customize SSL connection options.
|
54
|
+
|
52
55
|
### Querying with unbuffered result as streaming rows
|
53
56
|
|
54
|
-
You can run simple queries using the <code>query</code> method, either in buffered and
|
57
|
+
You can run simple queries using the <code>query</code> method, either in buffered and
|
55
58
|
unbuffered mode. For large result sets, you probably do not want to use buffered results.
|
56
59
|
|
57
60
|
Get all the result rows without buffering by providing a block:
|
@@ -60,7 +63,7 @@ Get all the result rows without buffering by providing a block:
|
|
60
63
|
puts row # => {:id => 123, :name => "Jim Bob"}
|
61
64
|
end
|
62
65
|
|
63
|
-
Note: you can only use the connection for one query at the time. If you try to run another
|
66
|
+
Note: you can only use the connection for one query at the time. If you try to run another
|
64
67
|
query when the connection is still busy delivering the results of a previous query, a
|
65
68
|
`Vertica::Error::SynchronizeError` will be raised. Use buffered resultsets to prevent this
|
66
69
|
problem.
|
@@ -69,33 +72,33 @@ Store the result of the query method as a variable to get a buffered resultset:
|
|
69
72
|
|
70
73
|
result = connection.query("SELECT id, name FROM my_table")
|
71
74
|
connection.close
|
72
|
-
|
75
|
+
|
73
76
|
result.rows # => [{:id => 123, :name => "Jim Bob"}, {:id => 456, :name => "Joe Jack"}]
|
74
77
|
result.row_count # => 2
|
75
|
-
|
78
|
+
|
76
79
|
result.each do |row|
|
77
80
|
puts row # => {:id => 123, :name => "Jim Bob"}
|
78
81
|
end
|
79
82
|
|
80
83
|
### Row format
|
81
84
|
|
82
|
-
By default, rows are returned as hashes, using symbols for the column names. Rows can also
|
85
|
+
By default, rows are returned as hashes, using symbols for the column names. Rows can also
|
83
86
|
be returned as arrays by providing a row_style:
|
84
87
|
|
85
88
|
connection.query("SELECT id, name FROM my_table", :row_style => :array) do |row|
|
86
89
|
puts row # => [123, "Jim Bob"]
|
87
90
|
end
|
88
|
-
|
89
|
-
By adding <code>:row_style => :array</code> to the connection hash, all results will be
|
91
|
+
|
92
|
+
By adding <code>:row_style => :array</code> to the connection hash, all results will be
|
90
93
|
returned as array.
|
91
94
|
|
92
|
-
### Loading data using COPY
|
95
|
+
### Loading data into Vertica using COPY
|
93
96
|
|
94
|
-
Using the COPY statement, you can load arbitrary data from your ruby script.
|
97
|
+
Using the COPY statement, you can load arbitrary data from your ruby script to the database.
|
95
98
|
|
96
99
|
connection.copy("COPY table FROM STDIN ...") do |stdin|
|
97
100
|
File.open('data.tsv', 'r') do |f|
|
98
|
-
begin
|
101
|
+
begin
|
99
102
|
stdin << f.gets
|
100
103
|
end until f.eof?
|
101
104
|
end
|
@@ -116,27 +119,26 @@ This package is MIT licensed. See the LICENSE file for more information.
|
|
116
119
|
This project comes with a test suite. The unit tests in <tt>/test/unit</tt> do not need a database
|
117
120
|
connection to run, the functional tests in <tt>/test/functional</tt> do need a working
|
118
121
|
database connection. You can specify the connection parameters by copying the file
|
119
|
-
<tt>/test/connection.yml.example</tt> to <tt>/test/connection.yml</tt> and filling out the
|
120
|
-
necessary fields.
|
122
|
+
<tt>/test/connection.yml.example</tt> to <tt>/test/connection.yml</tt> and filling out the
|
123
|
+
necessary fields.
|
121
124
|
|
122
|
-
Note that the test suite requires write access to the default schema of the provided connection,
|
123
|
-
although it tries to be as little invasive as possible: all tables it creates (and drops) are
|
125
|
+
Note that the test suite requires write access to the default schema of the provided connection,
|
126
|
+
although it tries to be as little invasive as possible: all tables it creates (and drops) are
|
124
127
|
prefixed with <tt>test_ruby_vertica_</tt>.
|
125
128
|
|
126
|
-
|
127
|
-
|
128
|
-
* Asynchronous / EventMachine version
|
129
|
+
The test suite is also run by Travis CI againast Vertica 7.0.1, and Ruby 1.9.3, 2.0.0, and 2.1.1.
|
129
130
|
|
130
131
|
### Authors
|
131
132
|
|
132
|
-
* [Matt Bauer](https://github.com/mattbauer) all the hard work
|
133
|
-
* [
|
134
|
-
* [Willem van Bergen](https://github.com/wvanbergen) contributor
|
133
|
+
* [Matt Bauer](https://github.com/mattbauer) & [Jeff Smick](https://github.com/sprsquish) all the hard work
|
134
|
+
* [Willem van Bergen](https://github.com/wvanbergen) current maintainer
|
135
135
|
* [Camilo Lopez](https://github.com/camilo) contributor
|
136
136
|
* [Erik Selin](https://github.com/tyro89) contributor
|
137
137
|
|
138
138
|
### See also
|
139
139
|
|
140
|
-
* [
|
141
|
-
* [
|
142
|
-
* [
|
140
|
+
* [Website](http://vanbergen.org/vertica)
|
141
|
+
* [API Documentation](http://www.rubydoc.info/gems/vertica/frames)
|
142
|
+
* [sequel-vertica](https://github.com/camilo/sequel-vertica): Sequel integration
|
143
|
+
* [newrelic-vertica](https://github.com/wvanbergen/newrelic-vertica): NewRelic monitoring of queries
|
144
|
+
* [node-vertica](https://github.com/wvanbergen/node-vertica): node.js Vertica driver
|
data/lib/vertica/connection.rb
CHANGED
@@ -37,7 +37,8 @@ class Vertica::Connection
|
|
37
37
|
require 'openssl'
|
38
38
|
raw_socket.write Vertica::Messages::SslRequest.new.to_bytes
|
39
39
|
if raw_socket.read(1) == 'S'
|
40
|
-
|
40
|
+
ssl_context = @options[:ssl].is_a?(OpenSSL::SSL::SSLContext) ? @options[:ssl] : OpenSSL::SSL::SSLContext.new
|
41
|
+
raw_socket = OpenSSL::SSL::SSLSocket.new(raw_socket, ssl_context)
|
41
42
|
raw_socket.sync = true
|
42
43
|
raw_socket.connect
|
43
44
|
else
|
data/lib/vertica/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Vertica
|
2
|
-
VERSION = "0.11.
|
3
|
-
end
|
2
|
+
VERSION = "0.11.2"
|
3
|
+
end
|
data/test/connection.yml.example
CHANGED
@@ -118,14 +118,14 @@ class ConnectionTest < Minitest::Test
|
|
118
118
|
|
119
119
|
def test_concurrent_access
|
120
120
|
connection = Vertica::Connection.new(TEST_CONNECTION_HASH)
|
121
|
-
t = Thread.new { connection.query("SELECT 1") }
|
122
|
-
sleep(0.
|
121
|
+
t = Thread.new { connection.query("SELECT sleep(1)") }
|
122
|
+
sleep(0.1)
|
123
123
|
|
124
|
-
assert connection.busy
|
124
|
+
assert connection.busy?, "The connection should be busy while executing a query"
|
125
125
|
assert_raises(Vertica::Error::SynchronizeError) { connection.query('SELECT 1') }
|
126
126
|
|
127
127
|
t.join
|
128
|
-
assert connection.ready_for_query
|
128
|
+
assert connection.ready_for_query?, "The connection should be available again."
|
129
129
|
connection.close
|
130
130
|
end
|
131
131
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vertica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Smick
|
@@ -10,34 +10,34 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - '>='
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: yard
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - '>='
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
@@ -65,7 +65,7 @@ extra_rdoc_files:
|
|
65
65
|
- README.md
|
66
66
|
files:
|
67
67
|
- .gitignore
|
68
|
-
- .
|
68
|
+
- .travis.yml
|
69
69
|
- Gemfile
|
70
70
|
- LICENSE
|
71
71
|
- README.md
|
@@ -132,17 +132,17 @@ require_paths:
|
|
132
132
|
- lib
|
133
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - '>='
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- -
|
140
|
+
- - '>='
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
144
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.0.14
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Pure Ruby library for interacting with Vertica
|