require("cipherstash-pg") require("stringio") $stderr.puts("Opening database connection ...") conn = CipherStashPG.connect(:dbname => "test") $stderr.puts("Running COPY command ...") buf = "" conn.transaction do conn.exec("COPY logs TO STDOUT WITH csv") while buf = conn.get_copy_data do $stdout.puts(buf) end end conn.finish