Class: Superset::Dataset::UpdateQuery
- Defined in:
- lib/superset/dataset/update_query.rb
Constant Summary
Constants inherited from Request
Instance Attribute Summary collapse
-
#dataset_id ⇒ Object
readonly
Returns the value of attribute dataset_id.
-
#new_query ⇒ Object
readonly
Returns the value of attribute new_query.
Attributes inherited from Request
Instance Method Summary collapse
-
#initialize(dataset_id:, new_query:) ⇒ UpdateQuery
constructor
A new instance of UpdateQuery.
- #params ⇒ Object
- #perform ⇒ Object
- #response ⇒ Object
- #source_dataset ⇒ Object
-
#sql_query_includes_hard_coded_schema? ⇒ Boolean
check if the sql query embedds the schema name, if so it can not be duplicated cleanly.
Methods inherited from Request
call, #query_params, #result, #superset_host
Methods included from Superset::Display
#display_headers, #headings, #list, #list_attributes, #result, #rows, #table, #title
Constructor Details
#initialize(dataset_id:, new_query:) ⇒ UpdateQuery
Returns a new instance of UpdateQuery.
7 8 9 10 |
# File 'lib/superset/dataset/update_query.rb', line 7 def initialize(dataset_id: ,new_query: ) @new_query = new_query @dataset_id = dataset_id end |
Instance Attribute Details
#dataset_id ⇒ Object (readonly)
Returns the value of attribute dataset_id.
5 6 7 |
# File 'lib/superset/dataset/update_query.rb', line 5 def dataset_id @dataset_id end |
#new_query ⇒ Object (readonly)
Returns the value of attribute new_query.
5 6 7 |
# File 'lib/superset/dataset/update_query.rb', line 5 def new_query @new_query end |
Instance Method Details
#params ⇒ Object
22 23 24 |
# File 'lib/superset/dataset/update_query.rb', line 22 def params { "sql": new_query } end |
#perform ⇒ Object
12 13 14 15 16 |
# File 'lib/superset/dataset/update_query.rb', line 12 def perform validate_proposed_changes response end |
#response ⇒ Object
18 19 20 |
# File 'lib/superset/dataset/update_query.rb', line 18 def response @response ||= client.put(route, params) end |
#source_dataset ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/superset/dataset/update_query.rb', line 31 def source_dataset # will raise an error if the dataset does not exist @source_dataset ||= begin dataset = Get.new(dataset_id) dataset.result end end |
#sql_query_includes_hard_coded_schema? ⇒ Boolean
check if the sql query embedds the schema name, if so it can not be duplicated cleanly
27 28 29 |
# File 'lib/superset/dataset/update_query.rb', line 27 def sql_query_includes_hard_coded_schema? new_query.include?("#{source_dataset['schema']}.") end |