blazer 1.8.2 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of blazer might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 59f81a05024d6f468c0ea49b89b5e579db529927
4
- data.tar.gz: 0fc5ddfc187287dc40f83226e16055543dc2067e
2
+ SHA256:
3
+ metadata.gz: 04030e79c10029d90894c9e21c4edc48bef986612d9c9a6a6d62c986a136b552
4
+ data.tar.gz: dfc84d3f6ec399ae42ca21fd388bf64e5f91913e22f49254ecc0c66264a4e67b
5
5
  SHA512:
6
- metadata.gz: 7efec4ba2d015c63c00082c00dd3e753c8fa1603c2c42b0d3a6e4f213020fd95f1563c5c836d472aa52622924446a650772f40f33f6f573b2999bd298c2cd536
7
- data.tar.gz: 52efcb9ea39e5a4d2146a7feac8cdc810a598137c0fe8a0f7f17852ee35e7258e67d491d2451ed7eecfdaf2c29797cf84efad656ef0af11d7b133fd09c8636af
6
+ metadata.gz: ffac6c51107f81ee2fb1a1762fb79eab02628aa1a9c1d59e8dbafa2f553560c7971db43af88bcc69919281b600bf0ff41b8a1bf54cd62a6ee3b12bbed67c5461
7
+ data.tar.gz: bd3a5f9d13cbb965a86e21dc0fd7ff97201d547245d4f4aea4b5f45498632c2e00653f498315c94b32b313195fa3859e7b5b9f81abf7d14a915dd60676ce9f9d
File without changes
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.9.0
2
+
3
+ - Prompt developers to check custom `before_action`
4
+ - Better ordering on home page
5
+ - Added support for Snowflake
6
+
1
7
  ## 1.8.2
2
8
 
3
9
  - Added support for Cassandra
data/CONTRIBUTING.md CHANGED
@@ -21,7 +21,10 @@ Think you’ve discovered an issue?
21
21
  gem "blazer", github: "ankane/blazer"
22
22
  ```
23
23
 
24
- If the above steps don’t help, create an issue. Include the complete backtrace for exceptions.
24
+ If the above steps don’t help, create an issue. Include:
25
+
26
+ - Detailed steps to reproduce
27
+ - Complete backtraces for exceptions
25
28
 
26
29
  ## Pull Requests
27
30
 
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Andrew Kane
1
+ Copyright (c) 2014-2018 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -123,7 +123,7 @@ Also, make sure authorization is enabled when you start the server.
123
123
 
124
124
  ### Sensitive Data
125
125
 
126
- To protect sensitive info like password hashes and access tokens, use views. Documentation coming soon.
126
+ Check out [Hypershield](https://github.com/ankane/hypershield) to shield sensitive data.
127
127
 
128
128
  ## Authentication
129
129
 
@@ -141,7 +141,7 @@ ENV["BLAZER_PASSWORD"] = "secret"
141
141
  ### Devise
142
142
 
143
143
  ```ruby
144
- authenticate :user, -> (user) { user.admin? } do
144
+ authenticate :user, ->(user) { user.admin? } do
145
145
  mount Blazer::Engine, at: "blazer"
146
146
  end
147
147
  ```
@@ -151,18 +151,20 @@ end
151
151
  Specify a `before_action` method to run in `blazer.yml`.
152
152
 
153
153
  ```yml
154
- before_action: require_admin
154
+ before_action_method: require_admin
155
155
  ```
156
156
 
157
- Then define the custom authentication method in your `application_controller.rb`.
157
+ You can define this method in your `ApplicationController`.
158
158
 
159
159
  ```ruby
160
160
  def require_admin
161
- # depending on your auth, maybe something like...
162
- current_user && current_user.admin?
161
+ # depending on your auth, something like...
162
+ redirect_to root_path unless current_user && current_user.admin?
163
163
  end
164
164
  ```
165
165
 
166
+ Be sure to render or redirect for unauthorized users.
167
+
166
168
  ## Queries
167
169
 
168
170
  ### Variables
@@ -392,21 +394,22 @@ data_sources:
392
394
 
393
395
  ### Full List
394
396
 
395
- - [PostgreSQL](#postgresql-1)
396
- - [MySQL](#mysql-1)
397
- - [SQL Server](#sql-server)
398
- - [Oracle](#oracle)
399
- - [IBM DB2 and Informix](#ibm-db2-and-informix)
400
- - [SQLite](#sqlite)
401
- - [Amazon Redshift](#amazon-redshift)
402
397
  - [Amazon Athena](#amazon-athena)
403
- - [Presto](#presto)
398
+ - [Amazon Redshift](#amazon-redshift)
404
399
  - [Apache Drill](#apache-drill)
405
- - [Google BigQuery](#google-bigquery)
406
- - [MongoDB](#mongodb-1)
407
400
  - [Cassandra](#cassandra)
408
401
  - [Druid](#druid)
409
- - [Elasticsearch](#elasticsearch-beta) [beta]
402
+ - [Elasticsearch](#elasticsearch) [beta]
403
+ - [Google BigQuery](#google-bigquery)
404
+ - [IBM DB2 and Informix](#ibm-db2-and-informix)
405
+ - [MongoDB](#mongodb-1)
406
+ - [MySQL](#mysql-1)
407
+ - [Oracle](#oracle)
408
+ - [PostgreSQL](#postgresql-1)
409
+ - [Presto](#presto)
410
+ - [Snowflake](#snowflake)
411
+ - [SQLite](#sqlite)
412
+ - [SQL Server](#sql-server)
410
413
 
411
414
  You can also [create an adapter](#creating-an-adapter) for any other data store.
412
415
 
@@ -418,151 +421,162 @@ data_sources:
418
421
  url: <%= ENV["BLAZER_MY_SOURCE_URL"] %>
419
422
  ```
420
423
 
421
- ### PostgreSQL
424
+ ### Amazon Athena
422
425
 
423
- Add [pg](https://bitbucket.org/ged/ruby-pg/wiki/Home) to your Gemfile (if it’s not there) and set:
426
+ Add [aws-sdk](https://github.com/aws/aws-sdk-ruby) `~> 2` to your Gemfile and set:
424
427
 
425
428
  ```yml
426
429
  data_sources:
427
430
  my_source:
428
- url: postgres://user:password@hostname:5432/database
431
+ adapter: athena
432
+ database: database
433
+ output_location: s3://some-bucket/
429
434
  ```
430
435
 
431
- ### MySQL
436
+ ### Amazon Redshift
432
437
 
433
- Add [mysql2](https://github.com/brianmario/mysql2) to your Gemfile (if it’s not there) and set:
438
+ Add [activerecord4-redshift-adapter](https://github.com/aamine/activerecord4-redshift-adapter) or [activerecord5-redshift-adapter](https://github.com/ConsultingMD/activerecord5-redshift-adapter) to your Gemfile and set:
434
439
 
435
440
  ```yml
436
441
  data_sources:
437
442
  my_source:
438
- url: mysql2://user:password@hostname:3306/database
443
+ url: redshift://user:password@hostname:5439/database
439
444
  ```
440
445
 
441
- ### SQL Server
446
+ ### Apache Drill
442
447
 
443
- Add [tiny_tds](https://github.com/rails-sqlserver/tiny_tds) and [activerecord-sqlserver-adapter](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter) to your Gemfile and set:
448
+ Add [drill-sergeant](https://github.com/ankane/drill-sergeant) to your Gemfile and set:
444
449
 
445
450
  ```yml
446
451
  data_sources:
447
452
  my_source:
448
- url: sqlserver://user:password@hostname:1433/database
453
+ adapter: drill
454
+ url: http://hostname:8047
449
455
  ```
450
456
 
451
- ### Oracle
457
+ ### Cassandra
452
458
 
453
- Use [activerecord-oracle_enhanced-adapter](https://github.com/rsim/oracle-enhanced).
459
+ Add [cassandra-driver](https://github.com/datastax/ruby-driver) to your Gemfile and set:
454
460
 
455
- ### IBM DB2 and Informix
461
+ ```yml
462
+ data_sources:
463
+ my_source:
464
+ url: cassandra://user:password@hostname:9042/keyspace
465
+ ```
456
466
 
457
- Use [ibm_db](https://github.com/ibmdb/ruby-ibmdb).
467
+ ### Druid
458
468
 
459
- ### SQLite
469
+ First, [enable SQL support](http://druid.io/docs/latest/querying/sql.html#configuration) on the broker.
460
470
 
461
- Add [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) to your Gemfile and set:
471
+ Set:
462
472
 
463
473
  ```yml
464
474
  data_sources:
465
475
  my_source:
466
- url: sqlite3:path/to/database.sqlite3
476
+ adapter: druid
477
+ url: http://hostname:8082
467
478
  ```
468
479
 
469
- ### Amazon Redshift
480
+ ### Elasticsearch
470
481
 
471
- Add [activerecord4-redshift-adapter](https://github.com/aamine/activerecord4-redshift-adapter) or [activerecord5-redshift-adapter](https://github.com/ConsultingMD/activerecord5-redshift-adapter) to your Gemfile and set:
482
+ Add [elasticsearch](https://github.com/elastic/elasticsearch-ruby) to your Gemfile and set:
472
483
 
473
484
  ```yml
474
485
  data_sources:
475
486
  my_source:
476
- url: redshift://user:password@hostname:5439/database
487
+ adapter: elasticsearch
488
+ url: http://user:password@hostname:9200
477
489
  ```
478
490
 
479
- ### Amazon Athena
491
+ ### Google BigQuery
480
492
 
481
- Add [aws-sdk](https://github.com/aws/aws-sdk-ruby) `~> 2` to your Gemfile and set:
493
+ Add [google-cloud-bigquery](https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/google-cloud-bigquery) to your Gemfile and set:
482
494
 
483
495
  ```yml
484
496
  data_sources:
485
497
  my_source:
486
- adapter: athena
487
- database: database
488
- output_location: s3://some-bucket/
498
+ adapter: bigquery
499
+ project: your-project
500
+ keyfile: path/to/keyfile.json
489
501
  ```
490
502
 
491
- ### Presto
503
+ ### IBM DB2 and Informix
492
504
 
493
- Add [presto-client](https://github.com/treasure-data/presto-client-ruby) to your Gemfile and set:
505
+ Use [ibm_db](https://github.com/ibmdb/ruby-ibmdb).
506
+
507
+ ### MongoDB
508
+
509
+ Add [mongo](https://github.com/mongodb/mongo-ruby-driver) to your Gemfile and set:
494
510
 
495
511
  ```yml
496
512
  data_sources:
497
513
  my_source:
498
- url: presto://user@hostname:8080/catalog
514
+ url: mongodb://user:password@hostname:27017/database
499
515
  ```
500
516
 
501
- ### Apache Drill
517
+ ### MySQL
502
518
 
503
- Add [drill-sergeant](https://github.com/ankane/drill-sergeant) to your Gemfile and set:
519
+ Add [mysql2](https://github.com/brianmario/mysql2) to your Gemfile (if it’s not there) and set:
504
520
 
505
521
  ```yml
506
522
  data_sources:
507
523
  my_source:
508
- adapter: drill
509
- url: http://hostname:8047
524
+ url: mysql2://user:password@hostname:3306/database
510
525
  ```
511
526
 
512
- ### Google BigQuery
527
+ ### Oracle
513
528
 
514
- Add [google-cloud-bigquery](https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/google-cloud-bigquery) to your Gemfile and set:
529
+ Use [activerecord-oracle_enhanced-adapter](https://github.com/rsim/oracle-enhanced).
530
+
531
+ ### PostgreSQL
532
+
533
+ Add [pg](https://bitbucket.org/ged/ruby-pg/wiki/Home) to your Gemfile (if it’s not there) and set:
515
534
 
516
535
  ```yml
517
536
  data_sources:
518
537
  my_source:
519
- adapter: bigquery
520
- project: your-project
521
- keyfile: path/to/keyfile.json
538
+ url: postgres://user:password@hostname:5432/database
522
539
  ```
523
540
 
524
- ### MongoDB
541
+ ### Presto
525
542
 
526
- Add [mongo](https://github.com/mongodb/mongo-ruby-driver) to your Gemfile and set:
543
+ Add [presto-client](https://github.com/treasure-data/presto-client-ruby) to your Gemfile and set:
527
544
 
528
545
  ```yml
529
546
  data_sources:
530
547
  my_source:
531
- url: mongodb://user:password@hostname:27017/database
548
+ url: presto://user@hostname:8080/catalog
532
549
  ```
533
550
 
534
- ### Cassandra
551
+ ### Snowflake
535
552
 
536
- Add [cassandra-driver](https://github.com/datastax/ruby-driver) to your Gemfile and set:
553
+ First, install the [ODBC driver](https://docs.snowflake.net/manuals/user-guide/odbc.html). Add [odbc_adapter](https://github.com/localytics/odbc_adapter) to your Gemfile and set:
537
554
 
538
555
  ```yml
539
556
  data_sources:
540
557
  my_source:
541
- url: cassandra://user:password@hostname:9042/keyspace
558
+ adapter: snowflake
559
+ dsn: ProductionSnowflake
542
560
  ```
543
561
 
544
- ### Druid
545
-
546
- First, [enable SQL support](http://druid.io/docs/latest/querying/sql.html#configuration) on the broker.
562
+ ### SQLite
547
563
 
548
- Set:
564
+ Add [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) to your Gemfile and set:
549
565
 
550
566
  ```yml
551
567
  data_sources:
552
568
  my_source:
553
- adapter: druid
554
- url: http://hostname:8082
569
+ url: sqlite3:path/to/database.sqlite3
555
570
  ```
556
571
 
557
- ### Elasticsearch [beta]
572
+ ### SQL Server
558
573
 
559
- Add [elasticsearch](https://github.com/elastic/elasticsearch-ruby) to your Gemfile and set:
574
+ Add [tiny_tds](https://github.com/rails-sqlserver/tiny_tds) and [activerecord-sqlserver-adapter](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter) to your Gemfile and set:
560
575
 
561
576
  ```yml
562
577
  data_sources:
563
578
  my_source:
564
- adapter: elasticsearch
565
- url: http://user:password@hostname:9200
579
+ url: sqlserver://user:password@hostname:1433/database
566
580
  ```
567
581
 
568
582
  ## Creating an Adapter
@@ -16,6 +16,10 @@ module Blazer
16
16
  http_basic_authenticate_with name: ENV["BLAZER_USERNAME"], password: ENV["BLAZER_PASSWORD"]
17
17
  end
18
18
 
19
+ if Blazer.settings["before_action"]
20
+ raise Blazer::Error, "The docs for protecting Blazer with a custom before_action had an incorrect example from August 2017 to June 2018. The example method had a boolean return value. However, you must render or redirect if a user is unauthorized rather than return a falsy value. Double check that your before_action works correctly for unauthorized users (if it worked when added, there should be no issue). Then, change before_action to before_action_method in config/blazer.yml."
21
+ end
22
+
19
23
  if Blazer.before_action
20
24
  before_action Blazer.before_action.to_sym
21
25
  end
@@ -1,6 +1,7 @@
1
1
  module Blazer
2
2
  class QueriesController < BaseController
3
3
  before_action :set_query, only: [:show, :edit, :update, :destroy, :refresh]
4
+ before_action :set_data_source, only: [:tables, :schema, :cancel]
4
5
 
5
6
  def home
6
7
  if params[:filter] == "dashboards"
@@ -83,7 +84,10 @@ module Blazer
83
84
  data_source = @query.data_source if @query && @query.data_source
84
85
  @data_source = Blazer.data_sources[data_source]
85
86
 
86
- if @run_id
87
+ # ensure viewable
88
+ if !(@query || Query.new(data_source: @data_source.id)).viewable?(blazer_user)
89
+ render_forbidden
90
+ elsif @run_id
87
91
  @timestamp = blazer_params[:timestamp].to_i
88
92
 
89
93
  @result = @data_source.run_results(@run_id)
@@ -174,20 +178,28 @@ module Blazer
174
178
  end
175
179
 
176
180
  def tables
177
- render json: Blazer.data_sources[params[:data_source]].tables
181
+ render json: @data_source.tables
178
182
  end
179
183
 
180
184
  def schema
181
- @schema = Blazer.data_sources[params[:data_source]].schema
185
+ @schema = @data_source.schema
182
186
  end
183
187
 
184
188
  def cancel
185
- Blazer.data_sources[params[:data_source]].cancel(blazer_run_id)
189
+ @data_source.cancel(blazer_run_id)
186
190
  head :ok
187
191
  end
188
192
 
189
193
  private
190
194
 
195
+ def set_data_source
196
+ @data_source = Blazer.data_sources[params[:data_source]]
197
+
198
+ unless Query.new(data_source: @data_source.id).editable?(blazer_user)
199
+ render_forbidden
200
+ end
201
+ end
202
+
191
203
  def continue_run
192
204
  render json: {run_id: @run_id, timestamp: @timestamp}, status: :accepted
193
205
  end
@@ -248,13 +260,6 @@ module Blazer
248
260
  end
249
261
 
250
262
  def set_queries(limit = nil)
251
- @my_queries =
252
- if limit && blazer_user && !params[:filter] && Blazer.audit
253
- queries_by_ids(Blazer::Audit.where(user_id: blazer_user.id).where("created_at > ?", 30.days.ago).where("query_id IS NOT NULL").group(:query_id).order("count_all desc").count.keys)
254
- else
255
- []
256
- end
257
-
258
263
  @queries = Blazer::Query.named.select(:id, :name, :creator_id, :statement)
259
264
  @queries = @queries.includes(:creator) if Blazer.user_class
260
265
 
@@ -263,7 +268,6 @@ module Blazer
263
268
  elsif blazer_user && params[:filter] == "viewed" && Blazer.audit
264
269
  @queries = queries_by_ids(Blazer::Audit.where(user_id: blazer_user.id).order(created_at: :desc).limit(500).pluck(:query_id).uniq)
265
270
  else
266
- @queries = @queries.where("id NOT IN (?)", @my_queries.map(&:id)) if @my_queries.any?
267
271
  @queries = @queries.limit(limit) if limit
268
272
  @queries = @queries.order(:name)
269
273
  end
@@ -271,7 +275,7 @@ module Blazer
271
275
 
272
276
  @more = limit && @queries.size >= limit
273
277
 
274
- @queries = (@my_queries + @queries).select { |q| !q.name.to_s.start_with?("#") || q.try(:creator).try(:id) == blazer_user.try(:id) }
278
+ @queries = @queries.select { |q| !q.name.to_s.start_with?("#") || q.try(:creator).try(:id) == blazer_user.try(:id) }
275
279
 
276
280
  @queries =
277
281
  @queries.map do |q|
@@ -294,6 +298,14 @@ module Blazer
294
298
 
295
299
  def set_query
296
300
  @query = Blazer::Query.find(params[:id].to_s.split("-").first)
301
+
302
+ unless @query.viewable?(blazer_user)
303
+ render_forbidden
304
+ end
305
+ end
306
+
307
+ def render_forbidden
308
+ render plain: "Access denied", status: :forbidden
297
309
  end
298
310
 
299
311
  def query_params
@@ -18,8 +18,17 @@ module Blazer
18
18
  name.to_s.sub(/\A[#\*]/, "").gsub(/\[.+\]/, "").strip
19
19
  end
20
20
 
21
+ def viewable?(user)
22
+ if Blazer.query_viewable
23
+ Blazer.query_viewable.call(self, user)
24
+ else
25
+ true
26
+ end
27
+ end
28
+
21
29
  def editable?(user)
22
30
  editable = !persisted? || (name.present? && name.first != "*" && name.first != "#") || user == try(:creator)
31
+ editable &&= viewable?(user)
23
32
  editable &&= Blazer.query_editable.call(self, user) if Blazer.query_editable
24
33
  editable
25
34
  end
@@ -17,7 +17,7 @@
17
17
  <%= link_to "Back", :back %>
18
18
  </div>
19
19
  <a :href="dataSourcePath" target="_blank" style="margin-right: 10px;">Schema</a>
20
- <%= f.select :data_source, Blazer.data_sources.values.select { |ds| q = @query.dup; q.data_source = ds.id; q.editable?(blazer_user) }.map { |ds| [ds.name, ds.id] }, {}, class: ("hide" if Blazer.data_sources.size == 1), style: "width: 140px;" %>
20
+ <%= f.select :data_source, Blazer.data_sources.values.select { |ds| q = @query.dup; q.data_source = ds.id; q.editable?(blazer_user) }.map { |ds| [ds.name, ds.id] }, {}, class: ("hide" if Blazer.data_sources.size <= 1), style: "width: 140px;" %>
21
21
  <div id="tables" style="display: inline-block; width: 250px; margin-right: 10px;">
22
22
  <select id="table_names" style="width: 240px;" placeholder="Preview table"></select>
23
23
  </div>
@@ -1,3 +1,5 @@
1
+ <% blazer_title "Database Schema" %>
2
+
1
3
  <% @schema.each do |table| %>
2
4
  <h4>
3
5
  <%= table[:table] %>
@@ -0,0 +1,73 @@
1
+ module Blazer
2
+ module Adapters
3
+ class SnowflakeAdapter < SqlAdapter
4
+ def initialize(data_source)
5
+ @data_source = data_source
6
+
7
+ @@registered ||= begin
8
+ require "active_record/connection_adapters/odbc_adapter"
9
+ require "odbc_adapter/adapters/postgresql_odbc_adapter"
10
+
11
+ ODBCAdapter.register(/snowflake/, ODBCAdapter::Adapters::PostgreSQLODBCAdapter) do
12
+ # Explicitly turning off prepared statements as they are not yet working with
13
+ # snowflake + the ODBC ActiveRecord adapter
14
+ def prepared_statements
15
+ false
16
+ end
17
+
18
+ # Quoting needs to be changed for snowflake
19
+ def quote_column_name(name)
20
+ name.to_s
21
+ end
22
+
23
+ private
24
+
25
+ # Override dbms_type_cast to get the values encoded in UTF-8
26
+ def dbms_type_cast(columns, values)
27
+ int_column = {}
28
+ columns.each_with_index do |c, i|
29
+ int_column[i] = c.type == 3 && c.scale == 0
30
+ end
31
+
32
+ float_column = {}
33
+ columns.each_with_index do |c, i|
34
+ float_column[i] = c.type == 3 && c.scale != 0
35
+ end
36
+
37
+ values.each do |row|
38
+ row.each_index do |idx|
39
+ val = row[idx]
40
+ if val
41
+ if int_column[idx]
42
+ row[idx] = val.to_i
43
+ elsif float_column[idx]
44
+ row[idx] = val.to_f
45
+ elsif val.is_a?(String)
46
+ row[idx] = val.force_encoding('UTF-8')
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ @connection_model =
56
+ Class.new(Blazer::Connection) do
57
+ def self.name
58
+ "Blazer::Connection::SnowflakeAdapter#{object_id}"
59
+ end
60
+ if data_source.settings["conn_str"]
61
+ establish_connection(adapter: "odbc", conn_str: data_source.settings["conn_str"])
62
+ elsif data_source.settings["dsn"]
63
+ establish_connection(adapter: "odbc", dsn: data_source.settings["dsn"])
64
+ end
65
+ end
66
+ end
67
+
68
+ def cancel(run_id)
69
+ # todo
70
+ end
71
+ end
72
+ end
73
+ end
@@ -145,7 +145,7 @@ module Blazer
145
145
 
146
146
  def adapter_instance
147
147
  @adapter_instance ||= begin
148
- unless settings["url"] || Rails.env.development? || ["bigquery", "athena"].include?(settings["adapter"])
148
+ unless settings["url"] || Rails.env.development? || ["bigquery", "athena", "snowflake"].include?(settings["adapter"])
149
149
  raise Blazer::Error, "Empty url for data source: #{id}"
150
150
  end
151
151
 
data/lib/blazer/engine.rb CHANGED
@@ -11,7 +11,7 @@ module Blazer
11
11
  Blazer.audit = Blazer.settings.key?("audit") ? Blazer.settings["audit"] : true
12
12
  Blazer.user_name = Blazer.settings["user_name"] if Blazer.settings["user_name"]
13
13
  Blazer.from_email = Blazer.settings["from_email"] if Blazer.settings["from_email"]
14
- Blazer.before_action = Blazer.settings["before_action"] if Blazer.settings["before_action"]
14
+ Blazer.before_action = Blazer.settings["before_action_method"] if Blazer.settings["before_action_method"]
15
15
  Blazer.check_schedules = Blazer.settings["check_schedules"] if Blazer.settings.key?("check_schedules")
16
16
  Blazer.cache ||= Rails.cache
17
17
 
@@ -1,3 +1,3 @@
1
1
  module Blazer
2
- VERSION = "1.8.2"
2
+ VERSION = "1.9.0"
3
3
  end
data/lib/blazer.rb CHANGED
@@ -16,6 +16,7 @@ require "blazer/adapters/elasticsearch_adapter"
16
16
  require "blazer/adapters/mongodb_adapter"
17
17
  require "blazer/adapters/presto_adapter"
18
18
  require "blazer/adapters/sql_adapter"
19
+ require "blazer/adapters/snowflake_adapter"
19
20
  require "blazer/engine"
20
21
 
21
22
  module Blazer
@@ -36,6 +37,7 @@ module Blazer
36
37
  attr_accessor :anomaly_checks
37
38
  attr_accessor :async
38
39
  attr_accessor :images
40
+ attr_accessor :query_viewable
39
41
  attr_accessor :query_editable
40
42
  end
41
43
  self.audit = true
@@ -202,3 +204,4 @@ Blazer.register_adapter "elasticsearch", Blazer::Adapters::ElasticsearchAdapter
202
204
  Blazer.register_adapter "presto", Blazer::Adapters::PrestoAdapter
203
205
  Blazer.register_adapter "mongodb", Blazer::Adapters::MongodbAdapter
204
206
  Blazer.register_adapter "sql", Blazer::Adapters::SqlAdapter
207
+ Blazer.register_adapter "snowflake", Blazer::Adapters::SnowflakeAdapter
@@ -47,8 +47,8 @@ audit: true
47
47
  # method name for the display name
48
48
  # user_name: name
49
49
 
50
- # optional auth method to use as a before_action (default: nil)
51
- # before_action: :authenticate!
50
+ # custom before_action to use for auth
51
+ # before_action_method: require_admin
52
52
 
53
53
  # email to send checks from
54
54
  # from_email: blazer@example.org
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: 1.8.2
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-22 00:00:00.000000000 Z
11
+ date: 2018-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -102,11 +102,11 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitattributes"
105
+ - ".github/ISSUE_TEMPLATE.md"
105
106
  - ".gitignore"
106
107
  - CHANGELOG.md
107
108
  - CONTRIBUTING.md
108
109
  - Gemfile
109
- - ISSUE_TEMPLATE.md
110
110
  - LICENSE.txt
111
111
  - README.md
112
112
  - Rakefile
@@ -190,6 +190,7 @@ files:
190
190
  - lib/blazer/adapters/elasticsearch_adapter.rb
191
191
  - lib/blazer/adapters/mongodb_adapter.rb
192
192
  - lib/blazer/adapters/presto_adapter.rb
193
+ - lib/blazer/adapters/snowflake_adapter.rb
193
194
  - lib/blazer/adapters/sql_adapter.rb
194
195
  - lib/blazer/data_source.rb
195
196
  - lib/blazer/detect_anomalies.R
@@ -222,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
223
  version: '0'
223
224
  requirements: []
224
225
  rubyforge_project:
225
- rubygems_version: 2.6.13
226
+ rubygems_version: 2.7.6
226
227
  signing_key:
227
228
  specification_version: 4
228
229
  summary: Explore your data with SQL. Easily create charts and dashboards, and share