Sha256: 51e8bd6fbdceaf9d5dac1ef2dbe627881dc09e56c27abf934d583503e1cf6fdc
Contents?: true
Size: 406 Bytes
Versions: 93
Compression:
Stored size: 406 Bytes
Contents
#!/usr/bin/env 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
93 entries across 93 versions & 6 rubygems