Sha256: 973a0e333ee29f446e952b30aac9faff431a583b01e6d9d8fff070ab6e82d65d

Contents?: true

Size: 421 Bytes

Versions: 3

Compression:

Stored size: 421 Bytes

Contents

# -*- ruby -*-

require 'yugabyte_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 = YugabyteYSQL.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
yugabyte_ysql-0.3 sample/copyto.rb
yugabyte_ysql-0.2 sample/copyto.rb
yugabyte_ysql-0.1 sample/copyto.rb