Class: Superset::Dashboard::Datasets::List
- Defined in:
- lib/superset/dashboard/datasets/list.rb
Constant Summary
Constants inherited from Request
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
dashboard id.
Attributes inherited from Request
Class Method Summary collapse
Instance Method Summary collapse
- #datasets_details ⇒ Object
-
#initialize(id) ⇒ List
constructor
A new instance of List.
- #perform ⇒ Object
- #schemas ⇒ Object
Methods inherited from Request
#query_params, #response, #result, #superset_host
Methods included from Superset::Display
#display_headers, #headings, #list, #result, #table
Constructor Details
#initialize(id) ⇒ List
Returns a new instance of List.
16 17 18 |
# File 'lib/superset/dashboard/datasets/list.rb', line 16 def initialize(id) @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
dashboard id
10 11 12 |
# File 'lib/superset/dashboard/datasets/list.rb', line 10 def id @id end |
Class Method Details
.call(id) ⇒ Object
12 13 14 |
# File 'lib/superset/dashboard/datasets/list.rb', line 12 def self.call(id) self.new(id).list end |
Instance Method Details
#datasets_details ⇒ Object
38 39 40 41 42 |
# File 'lib/superset/dashboard/datasets/list.rb', line 38 def datasets_details result.map do |details| details.slice('id', 'datasource_name', 'schema', 'sql').merge('database' => details['database'].slice('id', 'name', 'backend')).with_indifferent_access end end |
#perform ⇒ Object
20 21 22 23 |
# File 'lib/superset/dashboard/datasets/list.rb', line 20 def perform response self end |
#schemas ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/superset/dashboard/datasets/list.rb', line 25 def schemas @schemas ||= begin all_dashboard_schemas = result.map {|d| d[:schema] }.uniq # For the current superset setup we will assume a dashboard datasets will point to EXACTLY one schema, their own. # if not .. we need to know about it. Potentially we could override this check if others do not consider it a problem. if all_dashboard_schemas.count > 1 Rollbar.error("SUPERSET DASHBOARD ERROR: Dashboard id #{id} has multiple dataset schema linked: #{all_dashboard_schemas.to_s}") end all_dashboard_schemas end end |