Module: Turboquery

Defined in:
lib/turboquery.rb,
lib/turboquery.rb,
lib/turboquery/version.rb

Defined Under Namespace

Classes: Connection, DatabaseUrl, OLAP, OLTP, RemoteQuery, TableMover

Constant Summary collapse

VERSION =
'1.0.5'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.aws_bucketObject

Returns the value of attribute aws_bucket.



24
25
26
# File 'lib/turboquery.rb', line 24

def aws_bucket
  @aws_bucket
end

.aws_keyObject

Returns the value of attribute aws_key.



22
23
24
# File 'lib/turboquery.rb', line 22

def aws_key
  @aws_key
end

.aws_regionObject

Returns the value of attribute aws_region.



25
26
27
# File 'lib/turboquery.rb', line 25

def aws_region
  @aws_region
end

.aws_secretObject

Returns the value of attribute aws_secret.



23
24
25
# File 'lib/turboquery.rb', line 23

def aws_secret
  @aws_secret
end

.olap_database_urlObject

Returns the value of attribute olap_database_url.



21
22
23
# File 'lib/turboquery.rb', line 21

def olap_database_url
  @olap_database_url
end

.oltp_database_urlObject

Returns the value of attribute oltp_database_url.



20
21
22
# File 'lib/turboquery.rb', line 20

def oltp_database_url
  @oltp_database_url
end

.tmp_pathObject

Returns the value of attribute tmp_path.



26
27
28
# File 'lib/turboquery.rb', line 26

def tmp_path
  @tmp_path
end

Class Method Details

.after_forkObject



54
55
56
57
# File 'lib/turboquery.rb', line 54

def after_fork
  olap.after_fork
  oltp.after_fork
end

.config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Turboquery)

    the object that the method was called on



91
92
93
94
# File 'lib/turboquery.rb', line 91

def self.config
  yield self
  after_fork
end

.olapObject



40
41
42
# File 'lib/turboquery.rb', line 40

def olap
  @olap ||= Turboquery::OLAP.new
end

.oltpObject



36
37
38
# File 'lib/turboquery.rb', line 36

def oltp
  @oltp ||= Turboquery::OLTP.new
end

.query(sql, opts = {}) ⇒ Object



28
29
30
# File 'lib/turboquery.rb', line 28

def query(sql, opts = {})
  Turboquery::RemoteQuery.new(sql, opts).execute
end

.s3_bucketObject



44
45
46
47
48
49
50
51
52
# File 'lib/turboquery.rb', line 44

def s3_bucket
  @s3_bucket ||= begin
    Aws::S3::Resource.new(
      region: aws_region,
      access_key_id: aws_key,
      secret_access_key: aws_secret
    ).bucket(aws_bucket)
  end
end

.update_table(table) ⇒ Object



32
33
34
# File 'lib/turboquery.rb', line 32

def update_table(table)
  Turboquery::TableMover.new(source: oltp, destination: olap, from_table: table, to_table: "turboquery_#{table}")
end