superset 0.4.0 → 0.5.1
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 +4 -4
- data/AGENTS.md +1 -1
- data/CHANGELOG.md +16 -0
- data/README.md +17 -0
- data/lib/superset/client.rb +1 -1
- data/lib/superset/configuration.rb +11 -0
- data/lib/superset/dashboard/warm_up_cache.rb +3 -7
- data/lib/superset/guest_token.rb +1 -1
- data/lib/superset/logger.rb +2 -11
- data/lib/superset/version.rb +1 -1
- data/lib/superset.rb +30 -1
- data/superset.gemspec +3 -2
- metadata +10 -20
- data/lib/loggers/duplicate_dashboard_logger.rb +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a3d9470c571c5c52d7986021b754aec48a47aa96e8ba570833d7050802395550
|
|
4
|
+
data.tar.gz: 1699db0d45666f43b5e34a5090d1533aa293aa5aa4ad890cb6d8c47bc5f4e49a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42518d4e36fc4e46f9c570c7c6f70ce365d8ea3fd46c38de5b9d391c636425e5b95c18f8bd57712837b3d3bb9df44790e10a5ab50ef84cf7f2ba958c94ac0244
|
|
7
|
+
data.tar.gz: 5e51ed128fe8fff41e34e63a82d0039b517098d47856c2cb285cbc032e3926289a0dcde65ca56146c005f19e3bc5d88c51f38a8b0c6eed9b7eb2f9a4b22cb0da
|
data/AGENTS.md
CHANGED
|
@@ -98,7 +98,7 @@ Common operations: `ct` (contains), `eq` (equals), `neq` (not equals), `rel_o_m`
|
|
|
98
98
|
- `response` — raw (cached) HTTP response
|
|
99
99
|
- `result` — extracts `response['result']`
|
|
100
100
|
- Constructor filter params follow naming: `title_contains:`, `title_equals:`, etc.
|
|
101
|
-
- Logging goes to `log/superset-client.log
|
|
101
|
+
- Logging goes through `Superset.logger`; by default writes to `log/superset-client.log`. Consumers can inject any `::Logger`-compatible object via `Superset.configure { |c| c.logger = your_logger }`.
|
|
102
102
|
|
|
103
103
|
### Console Helpers
|
|
104
104
|
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1 - 2026-08-27
|
|
4
|
+
|
|
5
|
+
* **Fix:** `Superset::Client` and `Superset::GuestToken` raised `NameError: uninitialized constant FaradayMiddleware::ParseJson` on every request. Both connections used `FaradayMiddleware::ParseJson`, but this gem has never declared or required `faraday_middleware` — the constant only reached the bundle transitively via happi, and happi 1.0.0 dropped it. Replaced with Faraday's own `f.response :json`, which is equivalent (same `content_type:` option, same `respond_to?(:to_str)` guard, same `Faraday::ParsingError` on bad bodies)
|
|
6
|
+
* Raise the `faraday` floor from `~> 1.0` to `~> 1.10` — `Faraday::Response::Json` only ships from 1.10
|
|
7
|
+
* Pin the development `happi` to v1.0.0 so `faraday_middleware` is absent from this gem's own bundle and CI catches any reintroduction
|
|
8
|
+
* Add `#connection` specs to both classes asserting the handler stack, which the previous suite never exercised
|
|
9
|
+
|
|
10
|
+
## 0.5.0 - 2026-07-21
|
|
11
|
+
|
|
12
|
+
* Decouple from Rollbar — remove the `Rollbar.error(...) if defined?(Rollbar)` call in `WarmUpCache`; exceptions now propagate to the caller so consumers' own error handling can react
|
|
13
|
+
* Introduce configurable logger via `Superset.configure { |c| c.logger = ... }` — any object responding to `#info` and `#error` (default remains `log/superset-client.log`)
|
|
14
|
+
* **Breaking:** `Superset::Dashboard::WarmUpCache.new(...).perform` now raises on per-dataset failures instead of swallowing them; wrap the call in your own `rescue` if you need the previous silent behavior
|
|
15
|
+
* Remove unused `DuplicateDashboardLogger` module (dead code)
|
|
16
|
+
* Drop `rollbar` dev dependency; drop `require "rollbar"` from `spec_helper.rb` and `bin/console`
|
|
17
|
+
* Add explicit `require 'json'` (the gem uses `to_json` in 8+ places and was relying on rollbar to transitively load it)
|
|
18
|
+
|
|
3
19
|
## 0.4.0 - 2026-06-05
|
|
4
20
|
|
|
5
21
|
* send X-CSRFToken (and replay the session cookie) on state-changing requests so writes work against a CSRF-protected Superset
|
data/README.md
CHANGED
|
@@ -44,6 +44,23 @@ Add to your Gemfile `gem 'superset'`
|
|
|
44
44
|
And then execute: `bundle install`
|
|
45
45
|
Or install it yourself as `gem install superset`
|
|
46
46
|
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
The gem writes logs (dashboard duplication progress, API failures, etc.) through `Superset.logger`. By default it writes to `log/superset-client.log` relative to the working directory.
|
|
50
|
+
|
|
51
|
+
To route logs elsewhere — for example, STDOUT for a background worker, a null sink for tests, or your application's existing logger — configure it once at boot:
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
require 'logger'
|
|
55
|
+
require 'superset'
|
|
56
|
+
|
|
57
|
+
Superset.configure do |config|
|
|
58
|
+
config.logger = ::Logger.new($stdout) # or any object responding to #info(msg) and #error(msg)
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Any object that responds to `#info(msg)` and `#error(msg)` will work — a stdlib `::Logger`, a `SemanticLogger` instance, a framework-provided logger, or a custom wrapper that forwards to your error-reporting service. The gem does not assume any particular framework.
|
|
63
|
+
|
|
47
64
|
## Run specs
|
|
48
65
|
|
|
49
66
|
```
|
data/lib/superset/client.rb
CHANGED
|
@@ -77,7 +77,7 @@ module Superset
|
|
|
77
77
|
@connection ||= Faraday.new(superset_host) do |f|
|
|
78
78
|
f.authorization :Bearer, access_token
|
|
79
79
|
f.use :cookie_jar # persist the Flask session cookie across the csrf_token GET and the write
|
|
80
|
-
f.
|
|
80
|
+
f.response :json, content_type: 'application/json'
|
|
81
81
|
|
|
82
82
|
if self.config.use_json
|
|
83
83
|
f.request :json
|
|
@@ -3,7 +3,7 @@ module Superset
|
|
|
3
3
|
class WarmUpCache < Superset::Request
|
|
4
4
|
|
|
5
5
|
attr_reader :dashboard_id
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
def initialize(dashboard_id:)
|
|
8
8
|
@dashboard_id = dashboard_id
|
|
9
9
|
end
|
|
@@ -16,11 +16,7 @@ module Superset
|
|
|
16
16
|
def response
|
|
17
17
|
dataset_details = fetch_dataset_details(dashboard_id)
|
|
18
18
|
dataset_details.each do |dataset|
|
|
19
|
-
|
|
20
|
-
warm_up_dataset(dataset["datasource_name"], dataset["name"])
|
|
21
|
-
rescue => e
|
|
22
|
-
Rollbar.error("Warm up cache failed for the dashboard #{dashboard_id.to_s} and for the dataset #{dataset["datasource_name"]} - #{e}") if defined?(Rollbar)
|
|
23
|
-
end
|
|
19
|
+
warm_up_dataset(dataset["datasource_name"], dataset["name"])
|
|
24
20
|
end
|
|
25
21
|
end
|
|
26
22
|
|
|
@@ -29,7 +25,7 @@ module Superset
|
|
|
29
25
|
end
|
|
30
26
|
|
|
31
27
|
private
|
|
32
|
-
|
|
28
|
+
|
|
33
29
|
def validate_dashboard_id
|
|
34
30
|
raise InvalidParameterError, "dashboard_id must be present and must be an integer" unless dashboard_id.present? && dashboard_id.is_a?(Integer)
|
|
35
31
|
end
|
data/lib/superset/guest_token.rb
CHANGED
|
@@ -75,7 +75,7 @@ module Superset
|
|
|
75
75
|
@connection ||= Faraday.new(authenticator.superset_host) do |f|
|
|
76
76
|
f.authorization :Bearer, access_token
|
|
77
77
|
f.use :cookie_jar # replay the Flask session cookie from the csrf_token GET on the POST
|
|
78
|
-
f.
|
|
78
|
+
f.response :json, content_type: 'application/json'
|
|
79
79
|
f.request :json
|
|
80
80
|
f.adapter :net_http
|
|
81
81
|
end
|
data/lib/superset/logger.rb
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
module Superset
|
|
2
2
|
class Logger
|
|
3
|
-
|
|
4
3
|
def info(msg)
|
|
5
|
-
|
|
6
|
-
logger.info msg
|
|
4
|
+
Superset.logger.info(msg)
|
|
7
5
|
end
|
|
8
6
|
|
|
9
7
|
def error(msg)
|
|
10
|
-
|
|
11
|
-
logger.error msg
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def logger
|
|
15
|
-
@logger ||= begin
|
|
16
|
-
::Logger.new("log/superset-client.log")
|
|
17
|
-
end
|
|
8
|
+
Superset.logger.error(msg)
|
|
18
9
|
end
|
|
19
10
|
end
|
|
20
11
|
end
|
data/lib/superset/version.rb
CHANGED
data/lib/superset.rb
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
require 'require_all'
|
|
4
4
|
require 'terminal-table'
|
|
5
5
|
require 'happi'
|
|
6
|
+
require 'logger'
|
|
7
|
+
require 'json'
|
|
6
8
|
|
|
9
|
+
require_relative "superset/configuration"
|
|
7
10
|
require_rel "superset/credential"
|
|
8
11
|
require_relative "superset/authenticator"
|
|
9
12
|
require_relative "superset/client"
|
|
@@ -15,5 +18,31 @@ require_rel "superset"
|
|
|
15
18
|
|
|
16
19
|
module Superset
|
|
17
20
|
class Error < StandardError; end
|
|
18
|
-
|
|
21
|
+
|
|
22
|
+
DEFAULT_LOG_PATH = "log/superset-client.log"
|
|
23
|
+
|
|
24
|
+
class << self
|
|
25
|
+
def configuration
|
|
26
|
+
@configuration ||= Configuration.new
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def configure
|
|
30
|
+
yield configuration
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def logger
|
|
34
|
+
configuration.logger || default_logger
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def reset_configuration!
|
|
38
|
+
@configuration = nil
|
|
39
|
+
@default_logger = nil
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def default_logger
|
|
45
|
+
@default_logger ||= ::Logger.new(DEFAULT_LOG_PATH)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
19
48
|
end
|
data/superset.gemspec
CHANGED
|
@@ -37,7 +37,9 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_dependency "json", ">= 2.0"
|
|
38
38
|
spec.add_dependency "terminal-table", "~> 4.0"
|
|
39
39
|
spec.add_dependency "require_all", ">= 3.0"
|
|
40
|
-
|
|
40
|
+
# >= 1.10 because the connections use Faraday's own `f.response :json`
|
|
41
|
+
# (Faraday::Response::Json), which only ships from 1.10.
|
|
42
|
+
spec.add_dependency "faraday", "~> 1.10"
|
|
41
43
|
spec.add_dependency "faraday-multipart", "~> 1.0"
|
|
42
44
|
spec.add_dependency "faraday-cookie_jar", "~> 0.0.7" # replay the Flask session cookie for CSRF
|
|
43
45
|
spec.add_dependency "enumerate_it", ">= 1.7"
|
|
@@ -53,7 +55,6 @@ Gem::Specification.new do |spec|
|
|
|
53
55
|
spec.add_development_dependency "rspec", ">= 3.0"
|
|
54
56
|
spec.add_development_dependency "rubocop", ">= 1.0"
|
|
55
57
|
spec.add_development_dependency "pry", ">= 0.14"
|
|
56
|
-
spec.add_development_dependency "rollbar", ">= 3.0"
|
|
57
58
|
|
|
58
59
|
# For more information and examples about making a new gem, check out our
|
|
59
60
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: superset
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- jbat
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-08-27 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: json
|
|
@@ -57,14 +58,14 @@ dependencies:
|
|
|
57
58
|
requirements:
|
|
58
59
|
- - "~>"
|
|
59
60
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '1.
|
|
61
|
+
version: '1.10'
|
|
61
62
|
type: :runtime
|
|
62
63
|
prerelease: false
|
|
63
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
65
|
requirements:
|
|
65
66
|
- - "~>"
|
|
66
67
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '1.
|
|
68
|
+
version: '1.10'
|
|
68
69
|
- !ruby/object:Gem::Dependency
|
|
69
70
|
name: faraday-multipart
|
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -191,20 +192,7 @@ dependencies:
|
|
|
191
192
|
- - ">="
|
|
192
193
|
- !ruby/object:Gem::Version
|
|
193
194
|
version: '0.14'
|
|
194
|
-
|
|
195
|
-
name: rollbar
|
|
196
|
-
requirement: !ruby/object:Gem::Requirement
|
|
197
|
-
requirements:
|
|
198
|
-
- - ">="
|
|
199
|
-
- !ruby/object:Gem::Version
|
|
200
|
-
version: '3.0'
|
|
201
|
-
type: :development
|
|
202
|
-
prerelease: false
|
|
203
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
204
|
-
requirements:
|
|
205
|
-
- - ">="
|
|
206
|
-
- !ruby/object:Gem::Version
|
|
207
|
-
version: '3.0'
|
|
195
|
+
description:
|
|
208
196
|
email:
|
|
209
197
|
- jonathon.batson@gmail.com
|
|
210
198
|
executables: []
|
|
@@ -230,7 +218,6 @@ files:
|
|
|
230
218
|
- docker-compose.override.yml
|
|
231
219
|
- docker-compose.yml
|
|
232
220
|
- env.sample
|
|
233
|
-
- lib/loggers/duplicate_dashboard_logger.rb
|
|
234
221
|
- lib/superset.rb
|
|
235
222
|
- lib/superset/authenticator.rb
|
|
236
223
|
- lib/superset/base_put_request.rb
|
|
@@ -243,6 +230,7 @@ files:
|
|
|
243
230
|
- lib/superset/chart/put.rb
|
|
244
231
|
- lib/superset/chart/update_dataset.rb
|
|
245
232
|
- lib/superset/client.rb
|
|
233
|
+
- lib/superset/configuration.rb
|
|
246
234
|
- lib/superset/credential/api_user.rb
|
|
247
235
|
- lib/superset/credential/embedded_user.rb
|
|
248
236
|
- lib/superset/dashboard/bulk_delete.rb
|
|
@@ -309,6 +297,7 @@ homepage: https://github.com/rdytech/superset-client
|
|
|
309
297
|
licenses:
|
|
310
298
|
- MIT
|
|
311
299
|
metadata: {}
|
|
300
|
+
post_install_message:
|
|
312
301
|
rdoc_options: []
|
|
313
302
|
require_paths:
|
|
314
303
|
- lib
|
|
@@ -323,7 +312,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
323
312
|
- !ruby/object:Gem::Version
|
|
324
313
|
version: '0'
|
|
325
314
|
requirements: []
|
|
326
|
-
rubygems_version: 3.
|
|
315
|
+
rubygems_version: 3.0.3.1
|
|
316
|
+
signing_key:
|
|
327
317
|
specification_version: 4
|
|
328
318
|
summary: A Ruby Client for Apache Superset API
|
|
329
319
|
test_files: []
|