Class: TreasureData::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/td/client.rb,
lib/td/client/version.rb

Constant Summary collapse

VERSION =
'2.0.0'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(apikey, opts = {}) ⇒ Client

Returns a new instance of Client.

Parameters:

  • apikey (String)

    TreasureData API key

  • opts (Hash) (defaults to: {})

    options for API



27
28
29
# File 'lib/td/client.rb', line 27

def initialize(apikey, opts={})
  @api = API.new(apikey, opts)
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



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

def api
  @api
end

Class Method Details

.authenticate(user, password, opts = {}) ⇒ Client

Returns instance of this class.

Parameters:

  • user (String)

    TreasureData username

  • password (String)

    TreasureData password

  • opts (Hash) (defaults to: {})

    options for API

Returns:

  • (Client)

    instance of this class



12
13
14
15
16
# File 'lib/td/client.rb', line 12

def self.authenticate(user, password, opts={})
  api = API.new(nil, opts)
  apikey = api.authenticate(user, password)
  new(apikey)
end

.server_status(opts = {}) ⇒ String

Returns HTTP status code of server returns.

Parameters:

  • opts (Hash) (defaults to: {})

    options for API

Returns:

  • (String)

    HTTP status code of server returns



20
21
22
23
# File 'lib/td/client.rb', line 20

def self.server_status(opts={})
  api = API.new(nil, opts)
  api.server_status
end

Instance Method Details

#accountAccount

Returns:



58
59
60
61
# File 'lib/td/client.rb', line 58

def 
  , plan, storage, guaranteed_cores, maximum_cores, created_at = @api.
  return Account.new(self, , plan, storage, guaranteed_cores, maximum_cores, created_at)
end

#add_apikey(user) ⇒ true

Parameters:

  • user (String)

Returns:

  • (true)


512
513
514
# File 'lib/td/client.rb', line 512

def add_apikey(user)
  @api.add_apikey(user)
end

#add_user(name, org, email, password) ⇒ true

Parameters:

  • name (String)
  • org (String)
  • email (String)
  • password (String)

Returns:

  • (true)


487
488
489
# File 'lib/td/client.rb', line 487

def add_user(name, org, email, password)
  @api.add_user(name, org, email, password)
end

#apikeyString

Returns API key.

Returns:

  • (String)

    API key



35
36
37
# File 'lib/td/client.rb', line 35

def apikey
  @api.apikey
end

#bulk_import(name) ⇒ BulkImport

Parameters:

  • name (String)

Returns:



341
342
343
344
# File 'lib/td/client.rb', line 341

def bulk_import(name)
  data = @api.show_bulk_import(name)
  BulkImport.new(self, data)
end

#bulk_import_delete_part(name, part_name) ⇒ nil

Parameters:

  • name (String)
  • part_name (String)

Returns:

  • (nil)


365
366
367
# File 'lib/td/client.rb', line 365

def bulk_import_delete_part(name, part_name)
  @api.bulk_import_delete_part(name, part_name)
end

#bulk_import_error_records(name, &block) ⇒ Hash

Parameters:

  • name (String)
  • block (Proc)

Returns:

  • (Hash)


335
336
337
# File 'lib/td/client.rb', line 335

def bulk_import_error_records(name, &block)
  @api.bulk_import_error_records(name, &block)
end

#bulk_import_upload_part(name, part_name, stream, size) ⇒ nil

Parameters:

  • name (String)
  • part_name (String)
  • stream (String, StringIO)
  • size (Fixnum)

Returns:

  • (nil)


358
359
360
# File 'lib/td/client.rb', line 358

def bulk_import_upload_part(name, part_name, stream, size)
  @api.bulk_import_upload_part(name, part_name, stream, size)
end

#bulk_importsArray<BulkImport>

Returns:



347
348
349
350
351
# File 'lib/td/client.rb', line 347

def bulk_imports
  @api.list_bulk_imports.map {|data|
    BulkImport.new(self, data)
  }
end

#bulk_load_create(name, database, table, job, opts = {}) ⇒ Object

name: String, database: String, table: String, job: BulkLoad -> BulkLoad



558
559
560
# File 'lib/td/client.rb', line 558

def bulk_load_create(name, database, table, job, opts = {})
  @api.bulk_load_create(name, database, table, job, opts)
end

#bulk_load_delete(name) ⇒ Object

name: String -> BulkLoad



573
574
575
# File 'lib/td/client.rb', line 573

def bulk_load_delete(name)
  @api.bulk_load_delete(name)
end

#bulk_load_guess(job) ⇒ Object

> BulkLoad::Job



538
539
540
# File 'lib/td/client.rb', line 538

def bulk_load_guess(job)
  @api.bulk_load_guess(job)
end

#bulk_load_history(name) ⇒ Object

name: String -> [Job]



578
579
580
# File 'lib/td/client.rb', line 578

def bulk_load_history(name)
  @api.bulk_load_history(name)
end

#bulk_load_issue(database, table, job) ⇒ Object

> String



548
549
550
# File 'lib/td/client.rb', line 548

def bulk_load_issue(database, table, job)
  @api.bulk_load_issue(database, table, job)
end

#bulk_load_listObject

nil -> [BulkLoad]



553
554
555
# File 'lib/td/client.rb', line 553

def bulk_load_list
  @api.bulk_load_list
end

#bulk_load_preview(job) ⇒ Object

> BulkLoad::Job



543
544
545
# File 'lib/td/client.rb', line 543

def bulk_load_preview(job)
  @api.bulk_load_preview(job)
end

#bulk_load_run(name, scheduled_time = nil) ⇒ Object



582
583
584
# File 'lib/td/client.rb', line 582

def bulk_load_run(name, scheduled_time = nil)
  @api.bulk_load_run(name, scheduled_time)
end

#bulk_load_show(name) ⇒ Object

name: String -> BulkLoad



563
564
565
# File 'lib/td/client.rb', line 563

def bulk_load_show(name)
  @api.bulk_load_show(name)
end

#bulk_load_update(name, settings) ⇒ Object

name: String, settings: Hash -> BulkLoad



568
569
570
# File 'lib/td/client.rb', line 568

def bulk_load_update(name, settings)
  @api.bulk_load_update(name, settings)
end

#change_database(db_name, table_name, new_db_name) ⇒ true

Parameters:

  • db_name (String)
  • table_name (String)
  • new_db_name (String)

Returns:

  • (true)


172
173
174
# File 'lib/td/client.rb', line 172

def change_database(db_name, table_name, new_db_name)
  @api.change_database(db_name, table_name, new_db_name)
end

#change_email(user, email) ⇒ true

Parameters:

  • user (String)
  • email (String)

Returns:

  • (true)


500
501
502
# File 'lib/td/client.rb', line 500

def change_email(user, email)
  @api.change_email(user, email)
end

#change_my_password(old_password, password) ⇒ true

Parameters:

  • old_password (String)
  • password (String)

Returns:

  • (true)


533
534
535
# File 'lib/td/client.rb', line 533

def change_my_password(old_password, password)
  @api.change_my_password(old_password, password)
end

#change_password(user, password) ⇒ true

Parameters:

  • user (String)
  • password (String)

Returns:

  • (true)


526
527
528
# File 'lib/td/client.rb', line 526

def change_password(user, password)
  @api.change_password(user, password)
end

#commit_bulk_import(name) ⇒ nil

Parameters:

  • name (String)

Returns:

  • (nil)


328
329
330
# File 'lib/td/client.rb', line 328

def commit_bulk_import(name)
  @api.commit_bulk_import(name)
end

#create_bulk_import(name, database, table, opts = {}) ⇒ nil

Parameters:

  • name (String)
  • database (String)
  • table (String)
  • opts (Hash) (defaults to: {})

Returns:

  • (nil)


296
297
298
# File 'lib/td/client.rb', line 296

def create_bulk_import(name, database, table, opts={})
  @api.create_bulk_import(name, database, table, opts)
end

#create_database(db_name, opts = {}) ⇒ true

Parameters:

  • db_name (String)
  • opts (Hash) (defaults to: {})

Returns:

  • (true)


47
48
49
# File 'lib/td/client.rb', line 47

def create_database(db_name, opts={})
  @api.create_database(db_name, opts)
end

#create_log_table(db_name, table_name, params = {}) ⇒ true

Parameters:

  • db (String)
  • table (String)
  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :expire_days (Fixnum)

    days to expire table

  • :include_v (Boolean) — default: true

    include v column on Hive

  • :detect_schema (Boolean) — default: true

    detect schema on import

Returns:

  • (true)


89
90
91
# File 'lib/td/client.rb', line 89

def create_log_table(db_name, table_name, params={})
  @api.create_log_table(db_name, table_name, params)
end

#create_result(name, url, opts = {}) ⇒ true

Parameters:

  • name (String)
  • url (String)
  • opts (Hash) (defaults to: {})

Returns:

  • (true)


464
465
466
# File 'lib/td/client.rb', line 464

def create_result(name, url, opts={})
  @api.create_result(name, url, opts)
end

#create_schedule(name, opts) ⇒ Time

Parameters:

  • name (String)
  • opts (Hash)

Returns:

  • (Time)

Raises:

  • (ArgumentError)


378
379
380
381
382
383
# File 'lib/td/client.rb', line 378

def create_schedule(name, opts)
  raise ArgumentError, "'cron' option is required" unless opts[:cron] || opts['cron']
  raise ArgumentError, "'query' option is required" unless opts[:query] || opts['query']
  start = @api.create_schedule(name, opts)
  return start && Time.parse(start)
end

#database(db_name) ⇒ Database

Parameters:

  • db_name (String)

Returns:

Raises:



73
74
75
76
77
78
79
80
81
# File 'lib/td/client.rb', line 73

def database(db_name)
  m = @api.list_databases
  m.each {|name,(count, created_at, updated_at, org, permission)|
    if name == db_name
      return Database.new(self, name, nil, count, created_at, updated_at, org, permission)
    end
  }
  raise NotFoundError, "Database '#{db_name}' does not exist"
end

#databasesArray

Returns databases.

Returns:

  • (Array)

    databases



64
65
66
67
68
69
# File 'lib/td/client.rb', line 64

def databases
  m = @api.list_databases
  m.map {|db_name,(count, created_at, updated_at, org, permission)|
    Database.new(self, db_name, nil, count, created_at, updated_at, org, permission)
  }
end

#delete_bulk_import(name) ⇒ nil

Parameters:

  • name (String)

Returns:

  • (nil)


302
303
304
# File 'lib/td/client.rb', line 302

def delete_bulk_import(name)
  @api.delete_bulk_import(name)
end

#delete_database(db_name) ⇒ Symbol

Parameters:

  • db_name (String)

Returns:

  • (Symbol)


53
54
55
# File 'lib/td/client.rb', line 53

def delete_database(db_name)
  @api.delete_database(db_name)
end

#delete_result(name) ⇒ true

Parameters:

  • name (String)

Returns:

  • (true)


470
471
472
# File 'lib/td/client.rb', line 470

def delete_result(name)
  @api.delete_result(name)
end

#delete_schedule(name) ⇒ Array

Parameters:

  • name (String)

Returns:

  • (Array)


387
388
389
# File 'lib/td/client.rb', line 387

def delete_schedule(name)
  @api.delete_schedule(name)
end

#delete_table(db_name, table_name) ⇒ Symbol

Parameters:

  • db_name (String)
  • table_name (String)

Returns:

  • (Symbol)


132
133
134
# File 'lib/td/client.rb', line 132

def delete_table(db_name, table_name)
  @api.delete_table(db_name, table_name)
end

#export(db_name, table_name, storage_type, opts = {}) ⇒ Job

Parameters:

  • db_name (String)
  • table_name (String)
  • storage_type (String)
  • opts (Hash) (defaults to: {})

Returns:



267
268
269
270
# File 'lib/td/client.rb', line 267

def export(db_name, table_name, storage_type, opts={})
  job_id = @api.export(db_name, table_name, storage_type, opts)
  Job.new(self, job_id, :export, nil)
end

#freeze_bulk_import(name) ⇒ nil

Parameters:

  • name (String)

Returns:

  • (nil)


308
309
310
# File 'lib/td/client.rb', line 308

def freeze_bulk_import(name)
  @api.freeze_bulk_import(name)
end

#history(name, from = nil, to = nil) ⇒ Array<ScheduledJob>

Parameters:

  • name (String)
  • from (Fixnum) (defaults to: nil)
  • to (Fixnum) (defaults to: nil)

Returns:



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/td/client.rb', line 411

def history(name, from=nil, to=nil)
  result = @api.history(name, from, to)
  result.map {|scheduled_at,job_id,type,status,query,start_at,end_at,result_url,priority,database|
    job_param = [job_id, type, query, status,
      nil, nil, # url, debug
      start_at, end_at,
      nil, # cpu_time
      nil, nil, # result_size, result
      result_url,
      nil, # hive_result_schema
      priority,
      nil, # retry_limit
      nil, # TODO org_name
      database]
    ScheduledJob.new(self, scheduled_at, *job_param)
  }
end

#import(db_name, table_name, format, stream, size, unique_id = nil) ⇒ Float

Parameters:

  • db_name (String)
  • table_name (String)
  • format (String)
  • stream (String, StringIO)
  • size (Fixnum)
  • unique_id (String) (defaults to: nil)

Returns:

  • (Float)


447
448
449
# File 'lib/td/client.rb', line 447

def import(db_name, table_name, format, stream, size, unique_id=nil)
  @api.import(db_name, table_name, format, stream, size, unique_id)
end

#job(job_id) ⇒ Job

Parameters:

  • job_id (String)

Returns:



209
210
211
212
213
214
215
# File 'lib/td/client.rb', line 209

def job(job_id)
  job_id = job_id.to_s
  type, query, status, url, debug, start_at, end_at, cpu_time,
    result_size, result_url, hive_result_schema, priority, retry_limit, org, db, duration, num_records = @api.show_job(job_id)
  Job.new(self, job_id, type, query, status, url, debug, start_at, end_at, cpu_time,
          result_size, nil, result_url, hive_result_schema, priority, retry_limit, org, db, duration, num_records)
end

#job_result(job_id) ⇒ Object

Parameters:

  • job_id (String)

Returns:

  • (Object)


225
226
227
# File 'lib/td/client.rb', line 225

def job_result(job_id)
  @api.job_result(job_id)
end

#job_result_each(job_id, &block) ⇒ nil

Parameters:

  • job_id (String)
  • block (Proc)

Returns:

  • (nil)


245
246
247
# File 'lib/td/client.rb', line 245

def job_result_each(job_id, &block)
  @api.job_result_each(job_id, &block)
end

#job_result_each_with_compr_size(job_id, &block) ⇒ nil

Parameters:

  • job_id (String)
  • block (Proc)

Returns:

  • (nil)


252
253
254
# File 'lib/td/client.rb', line 252

def job_result_each_with_compr_size(job_id, &block)
  @api.job_result_each_with_compr_size(job_id, &block)
end

#job_result_format(job_id, format, io = nil, &block) ⇒ String

Parameters:

  • job_id (String)
  • format (String)
  • io (IO) (defaults to: nil)
  • block (Proc)

Returns:

  • (String)


234
235
236
# File 'lib/td/client.rb', line 234

def job_result_format(job_id, format, io=nil, &block)
  @api.job_result_format(job_id, format, io, &block)
end

#job_result_raw(job_id, format, io = nil, &block) ⇒ Object



238
239
240
# File 'lib/td/client.rb', line 238

def job_result_raw(job_id, format, io=nil, &block)
  @api.job_result_raw(job_id, format, io, &block)
end

#job_status(job_id) ⇒ String

Returns HTTP status code.

Parameters:

  • job_id (String)

Returns:

  • (String)

    HTTP status code



219
220
221
# File 'lib/td/client.rb', line 219

def job_status(job_id)
  return @api.job_status(job_id)
end

#jobs(from = nil, to = nil, status = nil, conditions = nil) ⇒ Job

Parameters:

  • from (Fixnum) (defaults to: nil)
  • to (Fixnum) (defaults to: nil)
  • status (String) (defaults to: nil)
  • conditions (Hash) (defaults to: nil)

Returns:



196
197
198
199
200
201
202
203
204
205
# File 'lib/td/client.rb', line 196

def jobs(from=nil, to=nil, status=nil, conditions=nil)
  results = @api.list_jobs(from, to, status, conditions)
  results.map {|job_id, type, status, query, start_at, end_at, cpu_time,
               result_size, result_url, priority, retry_limit, org, db,
               duration, num_records|
    Job.new(self, job_id, type, query, status, nil, nil, start_at, end_at, cpu_time,
            result_size, nil, result_url, nil, priority, retry_limit, org, db,
            duration, num_records)
  }
end

#kill(job_id) ⇒ String

Returns former_status.

Parameters:

  • job_id (String)

Returns:

  • (String)

    former_status



258
259
260
# File 'lib/td/client.rb', line 258

def kill(job_id)
  @api.kill(job_id)
end

#list_apikeys(user) ⇒ Array<String>

Parameters:

  • user (String)

Returns:

  • (Array<String>)


506
507
508
# File 'lib/td/client.rb', line 506

def list_apikeys(user)
  @api.list_apikeys(user)
end

#list_bulk_import_parts(name) ⇒ Array

Parameters:

  • name (String)

Returns:

  • (Array)


371
372
373
# File 'lib/td/client.rb', line 371

def list_bulk_import_parts(name)
  @api.list_bulk_import_parts(name)
end

#partial_delete(db_name, table_name, to, from, opts = {}) ⇒ Job

Parameters:

  • db_name (String)
  • table_name (String)
  • to (Fixnum)
  • from (Fixnum)
  • opts (Hash) (defaults to: {})

Returns:



286
287
288
289
# File 'lib/td/client.rb', line 286

def partial_delete(db_name, table_name, to, from, opts={})
  job_id = @api.partial_delete(db_name, table_name, to, from, opts)
  Job.new(self, job_id, :partialdelete, nil)
end

#perform_bulk_import(name, opts = {}) ⇒ Job

Parameters:

  • name (String)
  • opts (Hash) (defaults to: {})

    options for API

Returns:



321
322
323
324
# File 'lib/td/client.rb', line 321

def perform_bulk_import(name, opts={})
  job_id = @api.perform_bulk_import(name, opts)
  Job.new(self, job_id, :bulk_import, nil)
end

#query(db_name, q, result_url = nil, priority = nil, retry_limit = nil, opts = {}) ⇒ Job

Parameters:

  • db_name (String)
  • q (String)
  • result_url (String) (defaults to: nil)
  • priority (Fixnum) (defaults to: nil)
  • retry_limit (Fixnum) (defaults to: nil)
  • opts (Hash) (defaults to: {})

Returns:

Raises:

  • (ArgumentError)


183
184
185
186
187
188
189
# File 'lib/td/client.rb', line 183

def query(db_name, q, result_url=nil, priority=nil, retry_limit=nil, opts={})
  # for compatibility, assume type is hive unless specifically specified
  type = opts[:type] || opts['type'] || :hive
  raise ArgumentError, "The specified query type is not supported: #{type}" unless [:hive, :pig, :impala, :presto].include?(type)
  job_id = @api.query(q, type, db_name, result_url, priority, retry_limit, opts)
  Job.new(self, job_id, type, q)
end

#remove_apikey(user, apikey) ⇒ true

Parameters:

  • user (String)
  • apikey (String)

Returns:

  • (true)


519
520
521
# File 'lib/td/client.rb', line 519

def remove_apikey(user, apikey)
  @api.remove_apikey(user, apikey)
end

#remove_user(user) ⇒ true

Parameters:

  • user (String)

Returns:

  • (true)


493
494
495
# File 'lib/td/client.rb', line 493

def remove_user(user)
  @api.remove_user(user)
end

#result_export(target_job_id, opts = {}) ⇒ Job

Parameters:

  • target_job_id (String)
  • opts (Hash) (defaults to: {})

Returns:



275
276
277
278
# File 'lib/td/client.rb', line 275

def result_export(target_job_id, opts={})
  job_id = @api.result_export(target_job_id, opts)
  Job.new(self, job_id, :result_export, nil)
end

#resultsArray<Result>

Returns:



452
453
454
455
456
457
458
# File 'lib/td/client.rb', line 452

def results
  results = @api.list_result
  rs = results.map {|name,url,organizations|
    Result.new(self, name, url, organizations)
  }
  return rs
end

#run_schedule(name, time, num) ⇒ Array<ScheduledJob>

Parameters:

  • name (String)
  • time (Fixnum)

    UNIX timestamp

  • num (Fixnum)

Returns:



433
434
435
436
437
438
# File 'lib/td/client.rb', line 433

def run_schedule(name, time, num)
  results = @api.run_schedule(name, time, num)
  results.map {|job_id,type,scheduled_at|
    ScheduledJob.new(self, scheduled_at, job_id, type, nil)
  }
end

#schedulesArray<Schedule>

Returns:



392
393
394
395
396
397
# File 'lib/td/client.rb', line 392

def schedules
  result = @api.list_schedules
  result.map {|name,cron,query,database,result_url,timezone,delay,next_time,priority,retry_limit,org_name|
    Schedule.new(self, name, cron, query, database, result_url, timezone, delay, next_time, priority, retry_limit, org_name)
  }
end

#server_statusString

Returns HTTP status code of server returns.

Returns:

  • (String)

    HTTP status code of server returns



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

def server_status
  @api.server_status
end

#swap_table(db_name, table_name1, table_name2) ⇒ true

Swap table names

Parameters:

  • db_name (String)
  • table_name1 (String)
  • table_name2 (String)

Returns:

  • (true)


99
100
101
# File 'lib/td/client.rb', line 99

def swap_table(db_name, table_name1, table_name2)
  @api.swap_table(db_name, table_name1, table_name2)
end

#table(db_name, table_name) ⇒ Table

Parameters:

  • db_name (String)
  • table_name (String)

Returns:

Raises:



150
151
152
153
154
155
156
157
# File 'lib/td/client.rb', line 150

def table(db_name, table_name)
  tables(db_name).each {|t|
    if t.name == table_name
      return t
    end
  }
  raise NotFoundError, "Table '#{db_name}.#{table_name}' does not exist"
end

#tables(db_name) ⇒ Array

Returns Tables.

Parameters:

  • db_name (String)

Returns:

  • (Array)

    Tables



138
139
140
141
142
143
144
145
# File 'lib/td/client.rb', line 138

def tables(db_name)
  m = @api.list_tables(db_name)
  m.map {|table_name, (type, schema, count, created_at, updated_at, estimated_storage_size, last_import, last_log_timestamp, expire_days, include_v)|
    schema = Schema.new.from_json(schema)
    Table.new(self, db_name, table_name, type, schema, count, created_at, updated_at,
      estimated_storage_size, last_import, last_log_timestamp, expire_days, include_v)
  }
end

#tail(db_name, table_name, count, to = nil, from = nil, &block) ⇒ Array?

Parameters:

  • db_name (String)
  • table_name (String)
  • count (Fixnum)
  • block (Proc)

Returns:

  • (Array, nil)


164
165
166
# File 'lib/td/client.rb', line 164

def tail(db_name, table_name, count, to = nil, from = nil, &block)
  @api.tail(db_name, table_name, count, to, from, &block)
end

#unfreeze_bulk_import(name) ⇒ nil

Parameters:

  • name (String)

Returns:

  • (nil)


314
315
316
# File 'lib/td/client.rb', line 314

def unfreeze_bulk_import(name)
  @api.unfreeze_bulk_import(name)
end

#update_expire(db_name, table_name, expire_days) ⇒ true

Parameters:

  • db_name (String)
  • table_name (String)
  • expire_days (Fixnum)

Returns:

  • (true)


125
126
127
# File 'lib/td/client.rb', line 125

def update_expire(db_name, table_name, expire_days)
  @api.update_expire(db_name, table_name, expire_days)
end

#update_schedule(name, params) ⇒ nil

Parameters:

  • name (String)
  • params (Hash)

Returns:

  • (nil)


402
403
404
405
# File 'lib/td/client.rb', line 402

def update_schedule(name, params)
  @api.update_schedule(name, params)
  nil
end

#update_schema(db_name, table_name, schema) ⇒ true

Parameters:

  • db_name (String)
  • table_name (String)
  • schema (String)

Returns:

  • (true)


107
108
109
# File 'lib/td/client.rb', line 107

def update_schema(db_name, table_name, schema)
  @api.update_schema(db_name, table_name, schema.to_json)
end

#update_table(db_name, table_name, params = {}) ⇒ true

Parameters:

  • db (String)
  • table (String)
  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :expire_days (Fixnum)

    days to expire table

  • :include_v (Boolean) — default: true

    include v column on Hive

  • :detect_schema (Boolean) — default: true

    detect schema on import

Returns:

  • (true)


117
118
119
# File 'lib/td/client.rb', line 117

def update_table(db_name, table_name, params={})
  @api.update_table(db_name, table_name, params)
end

#usersArray<User>

Returns:



475
476
477
478
479
480
# File 'lib/td/client.rb', line 475

def users
  list = @api.list_users
  list.map {|name,org,roles,email|
    User.new(self, name, org, roles, email)
  }
end