Class: Tumugi::Plugin::BigqueryTableTarget
- Inherits:
-
Object
- Object
- Tumugi::Plugin::BigqueryTableTarget
- Extended by:
- Forwardable
- Defined in:
- lib/tumugi/plugin/target/bigquery_table.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#dataset_id ⇒ Object
readonly
Returns the value of attribute dataset_id.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#table_id ⇒ Object
readonly
Returns the value of attribute table_id.
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(project_id: nil, dataset_id:, table_id:, client: nil) ⇒ BigqueryTableTarget
constructor
A new instance of BigqueryTableTarget.
Constructor Details
#initialize(project_id: nil, dataset_id:, table_id:, client: nil) ⇒ BigqueryTableTarget
Returns a new instance of BigqueryTableTarget.
16 17 18 19 20 21 22 23 |
# File 'lib/tumugi/plugin/target/bigquery_table.rb', line 16 def initialize(project_id: nil, dataset_id:, table_id:, client: nil) cfg = Tumugi.config.section('bigquery') @project_id = project_id || cfg.project_id @dataset_id = dataset_id @table_id = table_id @client = client || Tumugi::Plugin::Bigquery::Client.new(cfg.to_h.merge(project_id: @project_id)) @table = Tumugi::Plugin::Bigquery::Table.new(project_id: @client.project_id, dataset_id: @dataset_id, table_id: @table_id) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
14 15 16 |
# File 'lib/tumugi/plugin/target/bigquery_table.rb', line 14 def client @client end |
#dataset_id ⇒ Object (readonly)
Returns the value of attribute dataset_id.
14 15 16 |
# File 'lib/tumugi/plugin/target/bigquery_table.rb', line 14 def dataset_id @dataset_id end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
14 15 16 |
# File 'lib/tumugi/plugin/target/bigquery_table.rb', line 14 def project_id @project_id end |
#table_id ⇒ Object (readonly)
Returns the value of attribute table_id.
14 15 16 |
# File 'lib/tumugi/plugin/target/bigquery_table.rb', line 14 def table_id @table_id end |
Instance Method Details
#exist? ⇒ Boolean
25 26 27 |
# File 'lib/tumugi/plugin/target/bigquery_table.rb', line 25 def exist? @client.table_exist?(@dataset_id, @table_id, project_id: @project_id) end |