Class: Dag::Database

Inherits:
Model
  • Object
show all
Includes:
Client::Table
Defined in:
lib/dag/client/model/database.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#api

Instance Method Summary collapse

Methods included from Client::Table

#table, #tables

Constructor Details

#initialize(api, cluster_name, db_name, cluster_status: nil) ⇒ Database

Returns a new instance of Database.



3
4
5
6
7
8
9
10
# File 'lib/dag/client/model/database.rb', line 3

def initialize(api, cluster_name, db_name, cluster_status: nil)
  super(api)

  @cluster_name = cluster_name
  @cluster_status = cluster_status
  @db_name = db_name
  @name = @db_name
end

Instance Attribute Details

#cluster_nameObject (readonly)

Returns the value of attribute cluster_name.



12
13
14
# File 'lib/dag/client/model/database.rb', line 12

def cluster_name
  @cluster_name
end

#db_nameObject (readonly)

Returns the value of attribute db_name.



12
13
14
# File 'lib/dag/client/model/database.rb', line 12

def db_name
  @db_name
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/dag/client/model/database.rb', line 12

def name
  @name
end

Instance Method Details

#deleteObject



14
15
16
# File 'lib/dag/client/model/database.rb', line 14

def delete
  @api.delete_database(@cluster_name, @name)
end

#split(tbl_name, params) ⇒ Object

parameters ==

  • label - label

  • input_object_keys - array of object_keys. ex [“#bucket/$big_object1”, “#bucket/$big_object2”]

  • input_format - ‘csv’ or ‘tsv’ or ‘json’

  • schema - schema



24
25
26
27
28
29
30
# File 'lib/dag/client/model/database.rb', line 24

def split(tbl_name, params)
  split_info = @api.split_table(@cluster_name, @db_name, tbl_name, params)
  job_id = split_info['queryId']

  query_info = @api.query_info(job_id)
  Dag::Job.new(@api, query_info)
end