/vertica

Ruby Adapter For Vertica Databases

Primary LanguageRubyMIT LicenseMIT

Vertica

by Matt Bauer

Description

Vertica is a pure Ruby library for connecting to Vertica databases. You can learn more
about Vertica at http://www.vertica.com. This library currently supports queries and
prepared statements.

Install

$ gem install mattbauer-vertica —source http://gems.github.com

Source

Vertica’s git repo is available on GitHub, which can be browsed at:

http://github.com/mattbauer/vertica

and cloned from:

git://github.com/mattbauer/vertica.git

Usage

Example Query


  c = Vertica::Connection.new(
    :user     => 'user',
    :password => 'password',
    :host     => 'db_server',
    :port     => '5433',
    :database => 'db
  )
  r = c.query("SELECT * FROM my_table")
  puts r.row_count
  puts r.columns[0].name
  puts r.rows
  c.close

Example Prepared Statement


  c = Vertica::Connection.new(
    :user     => 'user',
    :password => 'password',
    :host     => 'db_server',
    :port     => '5433',
    :database => 'db
  )
  c.prepare("my_prepared_statement", "SELECT * FROM my_table WHERE id = ?", 1)
  r = c.execute_prepared("my_prepared_statement", 13)
  puts r.row_count
  puts r.columns[0].name
  puts r.rows
  c.close

Running The Tests

To run the tests, change the values in test_helper.rb to match your db configuration. Then
execute the create_schema.sql on the database. Then you may run the tests.