blazer 2.6.0 → 2.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +8 -6
- data/app/assets/javascripts/blazer/queries.js +12 -1
- data/app/views/blazer/dashboards/show.html.erb +3 -1
- data/app/views/blazer/queries/show.html.erb +1 -1
- data/lib/blazer/adapters/athena_adapter.rb +4 -3
- data/lib/blazer/adapters/sql_adapter.rb +9 -2
- data/lib/blazer/result.rb +2 -0
- data/lib/blazer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91a6508a46423aa3acbe9151fcc3a7519b27daacaff1ec46a2c5e5cb7afed8f1
|
4
|
+
data.tar.gz: 92f9465aed0bca2ba03b320e6b550271c1fff5c7a06a56905bf51a964e012046
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e4b04de87e7b0f32d3cb6f88c02634f4b400bcb9281f4fc9b39db80579abea02feab25f4e7ede93793af5a05a46160d70f8789b37e4d7914ef61427d0e2edeb
|
7
|
+
data.tar.gz: 49a48fdee3660a4178f3df8619f7bee4677da27431af2500d4e312db698090989868778ae8b544cf20f636aa71e63771148ab3a858229a2c1d3ce622258119f5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 2.6.3 (2022-05-11)
|
2
|
+
|
3
|
+
- Fixed error with canceling queries
|
4
|
+
|
5
|
+
## 2.6.2 (2022-05-06)
|
6
|
+
|
7
|
+
- Fixed error with Postgres when prepared statements are disabled with Rails < 6.1
|
8
|
+
|
9
|
+
## 2.6.1 (2022-04-21)
|
10
|
+
|
11
|
+
- Added `region` setting to Amazon Athena
|
12
|
+
- Fixed error with MySQL for Rails < 7
|
13
|
+
- Fixed error with binary data
|
14
|
+
|
1
15
|
## 2.6.0 (2022-04-20)
|
2
16
|
|
3
17
|
- Fixed quoting issue with variables
|
data/README.md
CHANGED
@@ -150,8 +150,8 @@ Create a user with read-only permissions:
|
|
150
150
|
|
151
151
|
```sql
|
152
152
|
BEGIN;
|
153
|
-
CREATE ROLE blazer LOGIN PASSWORD '
|
154
|
-
GRANT CONNECT ON DATABASE
|
153
|
+
CREATE ROLE blazer LOGIN PASSWORD 'secret';
|
154
|
+
GRANT CONNECT ON DATABASE dbname TO blazer;
|
155
155
|
GRANT USAGE ON SCHEMA public TO blazer;
|
156
156
|
GRANT SELECT ON ALL TABLES IN SCHEMA public TO blazer;
|
157
157
|
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO blazer;
|
@@ -163,7 +163,8 @@ COMMIT;
|
|
163
163
|
Create a user with read-only permissions:
|
164
164
|
|
165
165
|
```sql
|
166
|
-
|
166
|
+
CREATE USER 'blazer'@'127.0.0.1' IDENTIFIED BY 'secret';
|
167
|
+
GRANT SELECT, SHOW VIEW ON dbname.* TO 'blazer'@'127.0.0.1';
|
167
168
|
FLUSH PRIVILEGES;
|
168
169
|
```
|
169
170
|
|
@@ -171,8 +172,8 @@ FLUSH PRIVILEGES;
|
|
171
172
|
|
172
173
|
Create a user with read-only permissions:
|
173
174
|
|
174
|
-
```
|
175
|
-
db.createUser({user: "blazer", pwd: "
|
175
|
+
```javascript
|
176
|
+
db.createUser({user: "blazer", pwd: "secret", roles: ["read"]})
|
176
177
|
```
|
177
178
|
|
178
179
|
Also, make sure authorization is enabled when you start the server.
|
@@ -607,6 +608,7 @@ data_sources:
|
|
607
608
|
workgroup: primary
|
608
609
|
access_key_id: ...
|
609
610
|
secret_access_key: ...
|
611
|
+
region: ...
|
610
612
|
```
|
611
613
|
|
612
614
|
Here’s an example IAM policy:
|
@@ -709,7 +711,7 @@ Use a read-only user. Requires the [Thrift server](https://spark.apache.org/docs
|
|
709
711
|
|
710
712
|
### Cassandra
|
711
713
|
|
712
|
-
Add [cassandra-driver](https://github.com/datastax/ruby-driver) to your Gemfile and set:
|
714
|
+
Add [cassandra-driver](https://github.com/datastax/ruby-driver) (and [sorted_set](https://github.com/knu/sorted_set) for Ruby 3+) to your Gemfile and set:
|
713
715
|
|
714
716
|
```yml
|
715
717
|
data_sources:
|
@@ -3,6 +3,9 @@ var runningQueries = []
|
|
3
3
|
var maxQueries = 3
|
4
4
|
|
5
5
|
function runQuery(data, success, error) {
|
6
|
+
if (!data.data_source) {
|
7
|
+
throw new Error("Data source is required to cancel queries")
|
8
|
+
}
|
6
9
|
data.run_id = uuid()
|
7
10
|
var query = {
|
8
11
|
data: data,
|
@@ -50,7 +53,11 @@ function runQueryHelper(query) {
|
|
50
53
|
queryComplete(query)
|
51
54
|
}
|
52
55
|
}).fail( function(jqXHR, textStatus, errorThrown) {
|
53
|
-
|
56
|
+
// check jqXHR.status instead of query.canceled
|
57
|
+
// so it works for page navigation with Firefox and Safari
|
58
|
+
if (jqXHR.status === 0) {
|
59
|
+
cancelServerQuery(query)
|
60
|
+
} else {
|
54
61
|
var message = (typeof errorThrown === "string") ? errorThrown : errorThrown.message
|
55
62
|
if (!message) {
|
56
63
|
message = "An error occurred"
|
@@ -83,6 +90,8 @@ function cancelAllQueries() {
|
|
83
90
|
}
|
84
91
|
}
|
85
92
|
|
93
|
+
// needed for Chrome
|
94
|
+
// queries are canceled before unload with Firefox and Safari
|
86
95
|
$(window).on("unload", cancelAllQueries)
|
87
96
|
|
88
97
|
function cancelQuery(query) {
|
@@ -90,7 +99,9 @@ function cancelQuery(query) {
|
|
90
99
|
if (query.xhr) {
|
91
100
|
query.xhr.abort()
|
92
101
|
}
|
102
|
+
}
|
93
103
|
|
104
|
+
function cancelServerQuery(query) {
|
94
105
|
// tell server
|
95
106
|
var path = Routes.cancel_queries_path()
|
96
107
|
var data = {run_id: query.run_id, data_source: query.data_source}
|
@@ -39,7 +39,9 @@
|
|
39
39
|
</div>
|
40
40
|
</div>
|
41
41
|
<script>
|
42
|
-
|
42
|
+
<% data = {statement: query.statement, query_id: query.id, data_source: query.data_source, variables: variable_params(query), only_chart: true} %>
|
43
|
+
<% data.merge!(cohort_period: params[:cohort_period]) if params[:cohort_period] %>
|
44
|
+
<%= blazer_js_var "data", data %>
|
43
45
|
|
44
46
|
runQuery(data, function (data) {
|
45
47
|
$("#chart-<%= i %>").html(data)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% blazer_title @query.name %>
|
2
2
|
|
3
3
|
<% if @success %>
|
4
|
-
<% run_data = {statement: @query.statement, query_id: @query.id, variables: variable_params(@query)} %>
|
4
|
+
<% run_data = {statement: @query.statement, query_id: @query.id, data_source: @query.data_source, variables: variable_params(@query)} %>
|
5
5
|
<% run_data.merge!(forecast: "t") if params[:forecast] %>
|
6
6
|
<% run_data.merge!(cohort_period: params[:cohort_period]) if params[:cohort_period] %>
|
7
7
|
<% run_data.transform_keys!(&:to_s) if Rails::VERSION::STRING.to_f == 5.0 %>
|
@@ -169,11 +169,12 @@ module Blazer
|
|
169
169
|
|
170
170
|
def client_options
|
171
171
|
@client_options ||= begin
|
172
|
+
options = {}
|
172
173
|
if settings["access_key_id"] || settings["secret_access_key"]
|
173
|
-
|
174
|
-
else
|
175
|
-
{}
|
174
|
+
options[:credentials] = Aws::Credentials.new(settings["access_key_id"], settings["secret_access_key"])
|
176
175
|
end
|
176
|
+
options[:region] = settings["region"] if settings["region"]
|
177
|
+
options
|
177
178
|
end
|
178
179
|
end
|
179
180
|
end
|
@@ -191,9 +191,12 @@ module Blazer
|
|
191
191
|
|
192
192
|
# Redshift adapter silently ignores binds
|
193
193
|
def parameter_binding
|
194
|
-
if postgresql? ||
|
194
|
+
if postgresql? && (ActiveRecord::VERSION::STRING.to_f >= 6.1 || prepared_statements?)
|
195
|
+
# Active Record < 6.1 silently ignores binds with Postgres when prepared statements are disabled
|
195
196
|
:numeric
|
196
|
-
elsif
|
197
|
+
elsif sqlite?
|
198
|
+
:numeric
|
199
|
+
elsif mysql? && prepared_statements?
|
197
200
|
# Active Record silently ignores binds with MySQL when prepared statements are disabled
|
198
201
|
:positional
|
199
202
|
elsif sqlserver?
|
@@ -309,6 +312,10 @@ module Blazer
|
|
309
312
|
end
|
310
313
|
end
|
311
314
|
end
|
315
|
+
|
316
|
+
def prepared_statements?
|
317
|
+
connection_model.connection.prepared_statements
|
318
|
+
end
|
312
319
|
end
|
313
320
|
end
|
314
321
|
end
|
data/lib/blazer/result.rb
CHANGED
data/lib/blazer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|