superset 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 565da0973df5cfd3aa9f1c555f477a9a9d710870c143ea2ca1678ff85febf3e6
4
- data.tar.gz: 75620c8a9459443001e1b0ea62ccc5375f77d7bf5eb7b6bc6705bb840ed73b36
3
+ metadata.gz: b991d014f7094976acde768b112309443a38f741c2b4d2834ecc9575366ad1eb
4
+ data.tar.gz: 5701ba1956f94f51037b78f878cb6bb154c74509d4c86d9b0e2b71c83abc1af8
5
5
  SHA512:
6
- metadata.gz: 754a540a0a88322c7b63efce92ab04d44d3aaaebdd865f12ff7397414804e39a9e3a2586a6cfad0e26e0681fd556d22bc23b515ad69f7bc8ecdfd0a2f8aeb7b0
7
- data.tar.gz: 4c1f810364a9389712183eabb06c81d473a634d8e6f6306d3b7b4b312818ad872df252f071f6b29df73cf622ebc3d0db37f009a0600a83358c464832a3f607c9
6
+ metadata.gz: aaa349b9a890fea6b8a45323d80aca1ed9b57d0a71a39defed7430b72ce2ab92a37671b8f91d745c178d55d3e28d2e14b35fbad01c22c38db517ea13cafa94e9
7
+ data.tar.gz: 305171e61d4c0ecb3d5cd9b4c7e828f57aa3002e2b089996356c41264046095677c012ed6a147e4baad51aa74110e0189002f7967984b12f6fff22b361e40527
@@ -9,7 +9,7 @@ module Superset
9
9
  class List < Superset::Request
10
10
  attr_reader :dashboard_id, :include_filter_datasets, :include_catalog_lookup # id - dashboard id
11
11
 
12
- def initialize(dashboard_id:, include_filter_datasets: false, include_catalog_lookup: false)
12
+ def initialize(dashboard_id:, include_filter_datasets: true, include_catalog_lookup: true)
13
13
  @dashboard_id = dashboard_id
14
14
  @include_filter_datasets = include_filter_datasets
15
15
  @include_catalog_lookup = include_catalog_lookup
@@ -22,7 +22,7 @@ module Superset
22
22
 
23
23
  def datasets_details
24
24
  @datasets_details ||= begin
25
- datasets_list = chart_datasets + additional_filter_datasets
25
+ datasets_list = chart_datasets + Array(additional_filter_datasets)
26
26
  datasets_list = include_catalog_details(datasets_list) if include_catalog_lookup
27
27
  datasets_list.compact
28
28
  end
@@ -42,15 +42,9 @@ module Superset
42
42
 
43
43
  def rows
44
44
  datasets_details.map do |d|
45
- [
46
- d[:id],
47
- d[:datasource_name],
48
- d[:database][:id],
49
- d[:database][:name],
50
- d[:database][:backend],
51
- d[:schema],
52
- d[:filter_only]
53
- ]
45
+ row = [d[:id], d[:datasource_name], d[:database][:backend], d[:database][:id], d[:database][:name]]
46
+ row << d[:catalog] if include_catalog_lookup
47
+ row + [d[:schema], d[:filter_only]]
54
48
  end
55
49
  end
56
50
 
@@ -69,11 +63,11 @@ module Superset
69
63
 
70
64
  # list of any additional filter dataset details on the dashboard that are not used in charts
71
65
  def additional_filter_datasets
72
- return [] unless include_filter_datasets
66
+ return unless include_filter_datasets
73
67
 
74
68
  chart_dataset_ids = chart_datasets.map{|d| d['id'] }
75
69
  filter_dataset_ids_not_used_in_charts = filter_dataset_ids - chart_dataset_ids
76
- retrieve_filter_datasets(filter_dataset_ids_not_used_in_charts) unless filter_dataset_ids_not_used_in_charts.empty?
70
+ retrieve_filter_datasets(filter_dataset_ids_not_used_in_charts)
77
71
  end
78
72
 
79
73
  def filter_dataset_ids
@@ -100,7 +94,9 @@ module Superset
100
94
  end
101
95
 
102
96
  def list_attributes
103
- ['id', 'datasource_name', 'database_id', 'database_name', 'database_backend', 'schema', 'filter_only'].map(&:to_sym)
97
+ base = %w[id datasource_name database_backend database_id database_name]
98
+ base << 'catalog' if include_catalog_lookup
99
+ (base + %w[schema filter_only]).map(&:to_sym)
104
100
  end
105
101
 
106
102
  # when displaying a list of datasets, show dashboard title as well
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superset
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superset
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - jbat