Class: RedshiftCsv::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/redshift_csv/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConnection

Returns a new instance of Connection.



5
6
7
8
9
10
11
12
13
14
# File 'lib/redshift_csv/connection.rb', line 5

def initialize
  @config = {
    dbname: RedshiftCsv.config.dbname,
    user: RedshiftCsv.config.user,
    password: RedshiftCsv.config.password,
    host: RedshiftCsv.config.host,
    sslmode: 'require',
    port: 5439
  }
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/redshift_csv/connection.rb', line 3

def config
  @config
end

Instance Method Details

#run(sql) ⇒ Object



16
17
18
# File 'lib/redshift_csv/connection.rb', line 16

def run(sql)
  connection.exec(sql)
end