Sha256: 14d93dd3b49289452eba28ac89616e004f2ca5b0c26f7e5062c7d274fea7db28

Contents?: true

Size: 401 Bytes

Versions: 123

Compression:

Stored size: 401 Bytes

Contents

# -*- ruby -*-

require 'pg'
require 'stringio'

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

$stderr.puts "Opening database connection ..."
conn = PG.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

123 entries across 123 versions & 4 rubygems

Version Path
pg-1.5.1 sample/copyto.rb
pg-1.5.0-x86-mingw32 sample/copyto.rb
pg-1.5.0-x64-mingw-ucrt sample/copyto.rb
pg-1.5.0-x64-mingw32 sample/copyto.rb
pg-1.5.0 sample/copyto.rb
cipherstash-pg-1.0.0.beta.1-x86_64-darwin-21 ./sample/copyto.rb
cipherstash-pg-1.0.0.beta.1-arm64-darwin-21 ./sample/copyto.rb
cipherstash-pg-1.0.0.beta.1-x86_64-linux ./sample/copyto.rb
cipherstash-pg-1.0.0.beta.1-x86_64-darwin-22 ./sample/copyto.rb
cipherstash-pg-1.0.0.beta.1-arm64-darwin-22 ./sample/copyto.rb
cipherstash-pg-1.0.0.beta.1-aarch64-linux ./sample/copyto.rb
pg-1.4.6-x86-mingw32 sample/copyto.rb
pg-1.4.6-x64-mingw32 sample/copyto.rb
pg-1.4.6-x64-mingw-ucrt sample/copyto.rb
pg-1.4.6 sample/copyto.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/sample/copyto.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/sample/copyto.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/sample/copyto.rb
pg-1.4.5-x86-mingw32 sample/copyto.rb
pg-1.4.5-x64-mingw-ucrt sample/copyto.rb