Class: Yancya::BigQuery::Project
- Inherits:
-
Object
- Object
- Yancya::BigQuery::Project
- Includes:
- RequestExecutor
- Defined in:
- lib/yancya/big_query/project.rb
Instance Method Summary collapse
- #datasets ⇒ Object
-
#initialize(resource:, bq:) ⇒ Project
constructor
A new instance of Project.
- #jobs ⇒ Object
- #project_id ⇒ Object
- #query(sql) ⇒ Object
Constructor Details
#initialize(resource:, bq:) ⇒ Project
Returns a new instance of Project.
10 11 12 13 14 15 |
# File 'lib/yancya/big_query/project.rb', line 10 def initialize(resource:, bq:) @resource = resource @jobs = BigQuery::Jobs.new(bq: bq) @datasets = BigQuery::Datasets.new(bq: bq) @bq = bq end |
Instance Method Details
#datasets ⇒ Object
25 26 27 |
# File 'lib/yancya/big_query/project.rb', line 25 def datasets @datasets.list(project_id: project_id) end |
#jobs ⇒ Object
21 22 23 |
# File 'lib/yancya/big_query/project.rb', line 21 def jobs @jobs.list(project_id: project_id) end |
#project_id ⇒ Object
29 30 31 |
# File 'lib/yancya/big_query/project.rb', line 29 def project_id @resource["projectReference"]["projectId"] end |
#query(sql) ⇒ Object
17 18 19 |
# File 'lib/yancya/big_query/project.rb', line 17 def query(sql) @jobs.query(project_id: project_id, sql: sql) end |