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.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.aws_bucketObject

Returns the value of attribute aws_bucket.



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

def aws_bucket
  @aws_bucket
end

.aws_keyObject

Returns the value of attribute aws_key.



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

def aws_key
  @aws_key
end

.aws_regionObject

Returns the value of attribute aws_region.



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

def aws_region
  @aws_region
end

.aws_secretObject

Returns the value of attribute aws_secret.



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

def aws_secret
  @aws_secret
end

.olap_database_urlObject

Returns the value of attribute olap_database_url.



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

def olap_database_url
  @olap_database_url
end

.oltp_database_urlObject

Returns the value of attribute oltp_database_url.



18
19
20
# File 'lib/turboquery.rb', line 18

def oltp_database_url
  @oltp_database_url
end

.tmp_pathObject

Returns the value of attribute tmp_path.



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

def tmp_path
  @tmp_path
end

Class Method Details

.after_forkObject



52
53
54
55
# File 'lib/turboquery.rb', line 52

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



69
70
71
72
# File 'lib/turboquery.rb', line 69

def self.config
  yield self
  after_fork
end

.olapObject



38
39
40
# File 'lib/turboquery.rb', line 38

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

.oltpObject



34
35
36
# File 'lib/turboquery.rb', line 34

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

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



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

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

.s3_bucketObject



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

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



30
31
32
# File 'lib/turboquery.rb', line 30

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