Module: Remi::DataSubject::Postgres

Included in:
Extractor::Postgres, Loader::Postgres
Defined in:
lib/remi/data_subjects/postgres.rb

Overview

Contains methods shared between Postgres Extractor/Parser/Encoder/Loader

Instance Method Summary collapse

Instance Method Details

#connectionPG::Connection

Returns An authenticated postgres connection.

Returns:

  • (PG::Connection)

    An authenticated postgres connection



6
7
8
9
10
11
12
13
14
15
# File 'lib/remi/data_subjects/postgres.rb', line 6

def connection
  @connection ||= PG.connect(
    host:     @credentials[:host] || 'localhost',
    port:     @credentials[:port] || 5432,
    dbname:   @credentials[:dbname],
    user:     @credentials[:user] || `whoami`.chomp,
    password: @credentials[:password],
    sslmode:  @credentials[:sslmode] || 'allow'
  )
end