Sha256: a0976adab4e0bd61cb4e332bef09963e38496232e81fec3d8c0b852a93d2b8e6

Contents?: true

Size: 720 Bytes

Versions: 7

Compression:

Stored size: 720 Bytes

Contents

require 'jvertica'
require 'dotenv'

# Create .env file like
# HOSTNAME=
# USERNAME=
# PASSWORD=
Dotenv.load

params = {
  host: ENV['HOSTNAME'],
  port: 5433,
  user: ENV['USERNAME'],
  password: ENV['PASSWORD'],
}
puts params

vertica = Jvertica.connect(params)
vertica.query("CREATE TABLE IF NOT EXISTS sandbox.jvertica_test (id integer, str varchar(80))")
vertica.copy("COPY sandbox.jvertica_test FROM STDIN PARSER fjsonparser() NO COMMIT") do |io|
  File.open(File.expand_path('../data.json', __FILE__), 'r') do |f|
    begin
      io << f.gets
    end until f.eof?
  end
end
vertica.commit
vertica.query("SELECT * from sandbox.jvertica_test") do |row|
  p row
end
vertica.query("DROP TABLE sandbox.jvertica_test")

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jvertica-0.2.5 example/copy.rb
jvertica-0.2.4 example/copy.rb
jvertica-0.2.3 example/copy.rb
jvertica-0.2.2 example/copy.rb
jvertica-0.2.1 example/copy.rb
jvertica-0.2.0 example/copy.rb
jvertica-0.1.11 example/copy.rb