Method: Flydata::Command::Psql#generate_command

Defined in:
lib/flydata/source_postgresql/command/psql.rb

#generate_command(dbconf, args) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/flydata/source_postgresql/command/psql.rb', line 32

def generate_command(dbconf, args)
  password = Shellwords.escape(dbconf['password'])
  database = Shellwords.escape(dbconf['database'])
  host = Shellwords.escape(dbconf['host'])
  port = Shellwords.escape(dbconf['port'])
  username = Shellwords.escape(dbconf['username'])
  "PGCONNECT_TIMEOUT=5 PGPASSWORD=#{password} psql -d #{database} -h #{host} -p #{port} -U #{username}"
end