Sha256: 6baa5d47690a5a42802c812234ea722d77fd28b9e7d44d0f9b47064b12eeb701

Contents?: true

Size: 404 Bytes

Versions: 3

Compression:

Stored size: 404 Bytes

Contents

# -*- ruby -*-

require 'ysql'
require 'stringio'

# An example of how to stream data to your local host from the database as CSV.

$stderr.puts "Opening database connection ..."
conn = YSQL.connect(:dbname => 'test' )

$stderr.puts "Running COPY command ..."
buf = ''
conn.transaction do
	conn.exec( "COPY logs TO STDOUT WITH csv" )
	$stdout.puts( buf ) while buf = conn.get_copy_data
end

conn.finish

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yugabytedb-ysql-0.5 sample/copyto.rb
yugabytedb-ysql-0.4 sample/copyto.rb
yugabytedb-ysql-0.3 sample/copyto.rb