Class: Yancya::BigQuery::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/yancya/big_query/table.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource:, tables:) ⇒ Table



4
5
6
7
# File 'lib/yancya/big_query/table.rb', line 4

def initialize(resource:, tables:)
  @resource = resource
  @tables = tables
end

Instance Method Details

#dataset_idObject



13
14
15
# File 'lib/yancya/big_query/table.rb', line 13

def dataset_id
  table_reference["datasetId"]
end

#deleteObject



37
38
39
40
41
42
43
# File 'lib/yancya/big_query/table.rb', line 37

def delete
  @tables.delete(
    project_id: project_id,
    dataset_id: dataset_id,
    table_id: table_id
  )
end

#descriptionObject



21
22
23
# File 'lib/yancya/big_query/table.rb', line 21

def description
  @resource["description"]
end

#patch(table_reference:) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/yancya/big_query/table.rb', line 45

def patch(table_reference:)
  @tables.patch(
    project_id: project_id,
    dataset_id: dataset_id,
    table_id: table_id,
    table: table_reference
  )
end

#project_idObject



9
10
11
# File 'lib/yancya/big_query/table.rb', line 9

def project_id
  table_reference["projectId"]
end

#reloadObject



29
30
31
32
33
34
35
# File 'lib/yancya/big_query/table.rb', line 29

def reload
  @tables.get(
    project_id: project_id,
    dataset_id: dataset_id,
    table_id: table_id
  )
end

#schemaObject



25
26
27
# File 'lib/yancya/big_query/table.rb', line 25

def schema
  @resource["schema"]
end

#table_idObject



17
18
19
# File 'lib/yancya/big_query/table.rb', line 17

def table_id
  table_reference["tableId"]
end

#update(table_reference:) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/yancya/big_query/table.rb', line 54

def update(table_reference:)
  @tables.update(
    project_id: project_id,
    dataset_id: dataset_id,
    table_id: table_id,
    table: table_reference
  )
end