Sha256: a0162af9b26ecce68ad85434916d1fcfe12c7d21b52fa73c26d1a978c9767794
Contents?: true
Size: 410 Bytes
Versions: 6
Compression:
Stored size: 410 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 = PGconn.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
6 entries across 6 versions & 1 rubygems