blazer 2.4.2 → 2.6.4
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/CHANGELOG.md +64 -0
- data/README.md +155 -57
- data/app/assets/javascripts/blazer/Chart.js +14000 -13979
- data/app/assets/javascripts/blazer/bootstrap.js +300 -97
- data/app/assets/javascripts/blazer/queries.js +12 -1
- data/app/assets/javascripts/blazer/vue.js +10754 -9687
- data/app/assets/stylesheets/blazer/application.css +5 -0
- data/app/assets/stylesheets/blazer/bootstrap-propshaft.css +10 -0
- data/app/assets/stylesheets/blazer/bootstrap-sprockets.css.erb +10 -0
- data/app/assets/stylesheets/blazer/{bootstrap.css.erb → bootstrap.css} +527 -455
- data/app/controllers/blazer/base_controller.rb +45 -45
- data/app/controllers/blazer/dashboards_controller.rb +4 -11
- data/app/controllers/blazer/queries_controller.rb +31 -49
- data/app/models/blazer/query.rb +9 -3
- data/app/views/blazer/_variables.html.erb +5 -4
- data/app/views/blazer/dashboards/_form.html.erb +1 -1
- data/app/views/blazer/dashboards/show.html.erb +6 -4
- data/app/views/blazer/queries/_caching.html.erb +1 -1
- data/app/views/blazer/queries/_form.html.erb +3 -3
- data/app/views/blazer/queries/run.html.erb +5 -3
- data/app/views/blazer/queries/show.html.erb +12 -7
- data/app/views/layouts/blazer/application.html.erb +7 -2
- data/lib/blazer/adapters/athena_adapter.rb +73 -20
- data/lib/blazer/adapters/base_adapter.rb +16 -1
- data/lib/blazer/adapters/bigquery_adapter.rb +14 -3
- data/lib/blazer/adapters/cassandra_adapter.rb +15 -4
- data/lib/blazer/adapters/drill_adapter.rb +10 -0
- data/lib/blazer/adapters/druid_adapter.rb +36 -1
- data/lib/blazer/adapters/elasticsearch_adapter.rb +19 -4
- data/lib/blazer/adapters/hive_adapter.rb +10 -0
- data/lib/blazer/adapters/ignite_adapter.rb +12 -2
- data/lib/blazer/adapters/influxdb_adapter.rb +22 -10
- data/lib/blazer/adapters/mongodb_adapter.rb +4 -0
- data/lib/blazer/adapters/neo4j_adapter.rb +17 -2
- data/lib/blazer/adapters/opensearch_adapter.rb +52 -0
- data/lib/blazer/adapters/presto_adapter.rb +9 -0
- data/lib/blazer/adapters/salesforce_adapter.rb +5 -0
- data/lib/blazer/adapters/snowflake_adapter.rb +9 -0
- data/lib/blazer/adapters/soda_adapter.rb +9 -0
- data/lib/blazer/adapters/spark_adapter.rb +5 -0
- data/lib/blazer/adapters/sql_adapter.rb +41 -4
- data/{app/mailers → lib}/blazer/check_mailer.rb +0 -0
- data/lib/blazer/data_source.rb +90 -8
- data/lib/blazer/engine.rb +1 -4
- data/lib/blazer/result.rb +19 -1
- data/lib/blazer/run_statement.rb +7 -3
- data/lib/blazer/run_statement_job.rb +4 -2
- data/{app/mailers → lib}/blazer/slack_notifier.rb +19 -4
- data/lib/blazer/statement.rb +75 -0
- data/lib/blazer/version.rb +1 -1
- data/lib/blazer.rb +32 -8
- data/lib/generators/blazer/templates/config.yml.tt +2 -2
- data/lib/tasks/blazer.rake +5 -5
- data/licenses/LICENSE-bootstrap.txt +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b32d2190afc8df872db60250651c97eae9d202d0b23042a4b853169edbc2d458
|
4
|
+
data.tar.gz: 64cb17476627ce2108e2aaf9619648e4a743774983c29bcb7478a3b4500f4617
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6eb64793a84ba433e6a68caaa5419dbcbb3f80ae842854b486f552459e77b434bc7d43bacf1d97175fea1857c74e66b440f7de55cc1e591133740f47ea84f18
|
7
|
+
data.tar.gz: 0723a52bb56f41d3526d66799f19a6fa82b91cd51aa3a35b5bede9523012bc0cee291db1f6e71eb74657c8e595ac0dc1b3f20febb1687121c35830456b924c2a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,67 @@
|
|
1
|
+
## 2.6.4 (2022-05-24)
|
2
|
+
|
3
|
+
- Fixed error with caching
|
4
|
+
|
5
|
+
## 2.6.3 (2022-05-11)
|
6
|
+
|
7
|
+
- Fixed error with canceling queries
|
8
|
+
|
9
|
+
## 2.6.2 (2022-05-06)
|
10
|
+
|
11
|
+
- Fixed error with Postgres when prepared statements are disabled with Rails < 6.1
|
12
|
+
|
13
|
+
## 2.6.1 (2022-04-21)
|
14
|
+
|
15
|
+
- Added `region` setting to Amazon Athena
|
16
|
+
- Fixed error with MySQL for Rails < 7
|
17
|
+
- Fixed error with binary data
|
18
|
+
|
19
|
+
## 2.6.0 (2022-04-20)
|
20
|
+
|
21
|
+
- Fixed quoting issue with variables
|
22
|
+
- Custom adapters now need to specify how to quote variables in queries
|
23
|
+
- Added experimental support for Propshaft
|
24
|
+
- Fixed error with empty results with InfluxDB
|
25
|
+
|
26
|
+
## 2.5.0 (2022-01-04)
|
27
|
+
|
28
|
+
- Added support for Slack OAuth tokens
|
29
|
+
- Added experimental support for AnomalyDetection.rb
|
30
|
+
- Improved table preview for MySQL
|
31
|
+
- Fixed cohort analysis for MySQL
|
32
|
+
|
33
|
+
## 2.4.8 (2021-12-07)
|
34
|
+
|
35
|
+
- Added support for OpenSearch
|
36
|
+
- Removed `elasticsearch-xpack` dependency for Elasticsearch
|
37
|
+
|
38
|
+
## 2.4.7 (2021-09-25)
|
39
|
+
|
40
|
+
- Made Action Mailer optional
|
41
|
+
- Fixed error with multiple maps on dashboard
|
42
|
+
|
43
|
+
## 2.4.6 (2021-09-20)
|
44
|
+
|
45
|
+
- Added support for workgroup with Amazon Athena
|
46
|
+
- Added casting for timestamp with time zone columns with Amazon Athena
|
47
|
+
- Added support for setting credentials in config file with Amazon Athena
|
48
|
+
- Made output location optional with Amazon Athena
|
49
|
+
- Fixed casting error for `NULL` values with Amazon Athena
|
50
|
+
- Fixed issue with Google BigQuery only showing first page of results
|
51
|
+
|
52
|
+
## 2.4.5 (2021-09-15)
|
53
|
+
|
54
|
+
- Improved fix for some forked queries not appearing on home page
|
55
|
+
|
56
|
+
## 2.4.4 (2021-09-15)
|
57
|
+
|
58
|
+
- Fixed issue with some forked queries not appearing on home page
|
59
|
+
|
60
|
+
## 2.4.3 (2021-07-27)
|
61
|
+
|
62
|
+
- Added Prophet anomaly detection
|
63
|
+
- Fixed style for new select items
|
64
|
+
|
1
65
|
## 2.4.2 (2021-02-08)
|
2
66
|
|
3
67
|
- Added support for Apache Ignite
|
data/README.md
CHANGED
@@ -10,6 +10,8 @@ Blazer is also available as a [Docker image](https://github.com/ankane/blazer-do
|
|
10
10
|
|
11
11
|
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
|
12
12
|
|
13
|
+
[](https://github.com/ankane/blazer/actions)
|
14
|
+
|
13
15
|
## Features
|
14
16
|
|
15
17
|
- **Multiple data sources** - PostgreSQL, MySQL, Redshift, and [many more](#full-list)
|
@@ -37,7 +39,7 @@ Blazer is also available as a [Docker image](https://github.com/ankane/blazer-do
|
|
37
39
|
Add this line to your application’s Gemfile:
|
38
40
|
|
39
41
|
```ruby
|
40
|
-
gem
|
42
|
+
gem "blazer"
|
41
43
|
```
|
42
44
|
|
43
45
|
Run:
|
@@ -59,7 +61,7 @@ For production, specify your database:
|
|
59
61
|
ENV["BLAZER_DATABASE_URL"] = "postgres://user:password@hostname:5432/database"
|
60
62
|
```
|
61
63
|
|
62
|
-
Blazer tries to protect against queries which modify data
|
64
|
+
When possible, Blazer tries to protect against queries which modify data by running each query in a transaction and rolling it back, but a safer approach is to use a read-only user. [See how to create one](#permissions).
|
63
65
|
|
64
66
|
#### Checks (optional)
|
65
67
|
|
@@ -142,16 +144,14 @@ Be sure to render or redirect for unauthorized users.
|
|
142
144
|
|
143
145
|
## Permissions
|
144
146
|
|
145
|
-
Blazer runs each query in a transaction and rolls it back to prevent queries from modifying data. As an additional line of defense, we recommend using a read only user.
|
146
|
-
|
147
147
|
### PostgreSQL
|
148
148
|
|
149
|
-
Create a user with read
|
149
|
+
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;
|
@@ -160,19 +160,20 @@ COMMIT;
|
|
160
160
|
|
161
161
|
### MySQL
|
162
162
|
|
163
|
-
Create a user with read
|
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
|
|
170
171
|
### MongoDB
|
171
172
|
|
172
|
-
Create a user with read
|
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.
|
@@ -412,74 +413,62 @@ SELECT users.id AS user_id, orders.created_at AS conversion_time, users.created_
|
|
412
413
|
FROM users LEFT JOIN orders ON orders.user_id = users.id
|
413
414
|
```
|
414
415
|
|
415
|
-
This feature requires PostgreSQL or MySQL.
|
416
|
+
This feature requires PostgreSQL or MySQL 8.
|
416
417
|
|
417
418
|
## Anomaly Detection
|
418
419
|
|
419
|
-
Blazer supports
|
420
|
-
|
421
|
-
### Trend
|
420
|
+
Blazer supports three different approaches to anomaly detection.
|
422
421
|
|
423
|
-
|
422
|
+
### Prophet
|
424
423
|
|
425
|
-
Add [
|
424
|
+
Add [prophet-rb](https://github.com/ankane/prophet) to your Gemfile:
|
426
425
|
|
427
426
|
```ruby
|
428
|
-
gem
|
427
|
+
gem "prophet-rb"
|
429
428
|
```
|
430
429
|
|
431
430
|
And add to `config/blazer.yml`:
|
432
431
|
|
433
432
|
```yml
|
434
|
-
anomaly_checks:
|
435
|
-
```
|
436
|
-
|
437
|
-
For the [self-hosted API](https://github.com/ankane/trend-api), create an initializer with:
|
438
|
-
|
439
|
-
```ruby
|
440
|
-
Trend.url = "http://localhost:8000"
|
433
|
+
anomaly_checks: prophet
|
441
434
|
```
|
442
435
|
|
443
|
-
###
|
436
|
+
### Trend
|
444
437
|
|
445
|
-
|
438
|
+
[Trend](https://trendapi.org/) uses an external service by default, but you can run it on your own infrastructure as well.
|
446
439
|
|
447
|
-
|
440
|
+
Add [trend](https://github.com/ankane/trend) to your Gemfile:
|
448
441
|
|
449
|
-
```
|
450
|
-
|
451
|
-
remotes::install_github("twitter/AnomalyDetection")
|
442
|
+
```ruby
|
443
|
+
gem "trend"
|
452
444
|
```
|
453
445
|
|
454
446
|
And add to `config/blazer.yml`:
|
455
447
|
|
456
448
|
```yml
|
457
|
-
anomaly_checks:
|
449
|
+
anomaly_checks: trend
|
458
450
|
```
|
459
451
|
|
460
|
-
|
452
|
+
For the [self-hosted API](https://github.com/ankane/trend-api), create an initializer with:
|
461
453
|
|
462
|
-
|
454
|
+
```ruby
|
455
|
+
Trend.url = "http://localhost:8000"
|
456
|
+
```
|
463
457
|
|
464
|
-
###
|
458
|
+
### AnomalyDetection.rb (experimental)
|
465
459
|
|
466
|
-
Add
|
460
|
+
Add [anomaly_detection](https://github.com/ankane/AnomalyDetection.rb) to your Gemfile:
|
467
461
|
|
468
|
-
```
|
469
|
-
|
462
|
+
```ruby
|
463
|
+
gem "anomaly_detection"
|
470
464
|
```
|
471
465
|
|
472
|
-
And
|
466
|
+
And add to `config/blazer.yml`:
|
473
467
|
|
474
|
-
```
|
475
|
-
|
476
|
-
install.packages("remotes")
|
477
|
-
remotes::install_github("twitter/AnomalyDetection")
|
478
|
-
}
|
468
|
+
```yml
|
469
|
+
anomaly_checks: anomaly_detection
|
479
470
|
```
|
480
471
|
|
481
|
-
Commit and deploy away. The first deploy may take a few minutes.
|
482
|
-
|
483
472
|
## Forecasting
|
484
473
|
|
485
474
|
Blazer supports for two different forecasting methods. [Example](https://blazer.dokkuapp.com/queries/18-forecast?forecast=t)
|
@@ -488,10 +477,10 @@ A forecast link will appear for queries that return 2 columns with types timesta
|
|
488
477
|
|
489
478
|
### Prophet
|
490
479
|
|
491
|
-
Add [prophet](https://github.com/ankane/prophet) to your Gemfile:
|
480
|
+
Add [prophet-rb](https://github.com/ankane/prophet) to your Gemfile:
|
492
481
|
|
493
482
|
```ruby
|
494
|
-
gem
|
483
|
+
gem "prophet-rb", ">= 0.2.1"
|
495
484
|
```
|
496
485
|
|
497
486
|
And add to `config/blazer.yml`:
|
@@ -502,12 +491,12 @@ forecasting: prophet
|
|
502
491
|
|
503
492
|
### Trend
|
504
493
|
|
505
|
-
[Trend](https://trendapi.org/) uses an external service.
|
494
|
+
[Trend](https://trendapi.org/) uses an external service by default, but you can run it on your own infrastructure as well.
|
506
495
|
|
507
496
|
Add [trend](https://github.com/ankane/trend) to your Gemfile:
|
508
497
|
|
509
498
|
```ruby
|
510
|
-
gem
|
499
|
+
gem "trend"
|
511
500
|
```
|
512
501
|
|
513
502
|
And add to `config/blazer.yml`:
|
@@ -516,6 +505,12 @@ And add to `config/blazer.yml`:
|
|
516
505
|
forecasting: trend
|
517
506
|
```
|
518
507
|
|
508
|
+
For the [self-hosted API](https://github.com/ankane/trend-api), create an initializer with:
|
509
|
+
|
510
|
+
```ruby
|
511
|
+
Trend.url = "http://localhost:8000"
|
512
|
+
```
|
513
|
+
|
519
514
|
## Uploads
|
520
515
|
|
521
516
|
Creating database tables from CSV files. [Example](https://blazer.dokkuapp.com/uploads)
|
@@ -567,7 +562,7 @@ data_sources:
|
|
567
562
|
- [Amazon Redshift](#amazon-redshift)
|
568
563
|
- [Apache Drill](#apache-drill)
|
569
564
|
- [Apache Hive](#apache-hive)
|
570
|
-
- [Apache Ignite](#apache-ignite)
|
565
|
+
- [Apache Ignite](#apache-ignite)
|
571
566
|
- [Apache Spark](#apache-spark)
|
572
567
|
- [Cassandra](#cassandra)
|
573
568
|
- [Druid](#druid)
|
@@ -578,6 +573,7 @@ data_sources:
|
|
578
573
|
- [MongoDB](#mongodb-1)
|
579
574
|
- [MySQL](#mysql-1)
|
580
575
|
- [Neo4j](#neo4j)
|
576
|
+
- [OpenSearch](#opensearch)
|
581
577
|
- [Oracle](#oracle)
|
582
578
|
- [PostgreSQL](#postgresql-1)
|
583
579
|
- [Presto](#presto)
|
@@ -606,9 +602,50 @@ data_sources:
|
|
606
602
|
my_source:
|
607
603
|
adapter: athena
|
608
604
|
database: database
|
605
|
+
|
606
|
+
# optional settings
|
609
607
|
output_location: s3://some-bucket/
|
608
|
+
workgroup: primary
|
609
|
+
access_key_id: ...
|
610
|
+
secret_access_key: ...
|
611
|
+
region: ...
|
612
|
+
```
|
613
|
+
|
614
|
+
Here’s an example IAM policy:
|
615
|
+
|
616
|
+
```json
|
617
|
+
{
|
618
|
+
"Version": "2012-10-17",
|
619
|
+
"Statement": [
|
620
|
+
{
|
621
|
+
"Effect": "Allow",
|
622
|
+
"Action": [
|
623
|
+
"athena:GetQueryExecution",
|
624
|
+
"athena:GetQueryResults",
|
625
|
+
"athena:StartQueryExecution"
|
626
|
+
],
|
627
|
+
"Resource": [
|
628
|
+
"arn:aws:athena:region:account-id:workgroup/primary"
|
629
|
+
]
|
630
|
+
},
|
631
|
+
{
|
632
|
+
"Effect": "Allow",
|
633
|
+
"Action": [
|
634
|
+
"glue:GetTable",
|
635
|
+
"glue:GetTables"
|
636
|
+
],
|
637
|
+
"Resource": [
|
638
|
+
"arn:aws:glue:region:account-id:catalog",
|
639
|
+
"arn:aws:glue:region:account-id:database/default",
|
640
|
+
"arn:aws:glue:region:account-id:table/default/*"
|
641
|
+
]
|
642
|
+
}
|
643
|
+
]
|
644
|
+
}
|
610
645
|
```
|
611
646
|
|
647
|
+
You also need to configure [S3 permissions](https://aws.amazon.com/premiumsupport/knowledge-center/access-denied-athena/).
|
648
|
+
|
612
649
|
### Amazon Redshift
|
613
650
|
|
614
651
|
Add [activerecord6-redshift-adapter](https://github.com/kwent/activerecord6-redshift-adapter) or [activerecord5-redshift-adapter](https://github.com/ConsultingMD/activerecord5-redshift-adapter) to your Gemfile and set:
|
@@ -619,6 +656,8 @@ data_sources:
|
|
619
656
|
url: redshift://user:password@hostname:5439/database
|
620
657
|
```
|
621
658
|
|
659
|
+
Use a [read-only user](https://docs.aws.amazon.com/redshift/latest/dg/r_GRANT.html).
|
660
|
+
|
622
661
|
### Apache Drill
|
623
662
|
|
624
663
|
Add [drill-sergeant](https://github.com/ankane/drill-sergeant) to your Gemfile and set:
|
@@ -630,6 +669,8 @@ data_sources:
|
|
630
669
|
url: http://hostname:8047
|
631
670
|
```
|
632
671
|
|
672
|
+
Use a [read-only user](https://drill.apache.org/docs/roles-and-privileges/).
|
673
|
+
|
633
674
|
### Apache Hive
|
634
675
|
|
635
676
|
Add [hexspace](https://github.com/ankane/hexspace) to your Gemfile and set:
|
@@ -653,6 +694,8 @@ data_sources:
|
|
653
694
|
url: ignite://user:password@hostname:10800
|
654
695
|
```
|
655
696
|
|
697
|
+
Use a [read-only user](https://www.gridgain.com/docs/latest/administrators-guide/security/authorization-permissions) (requires a third-party plugin).
|
698
|
+
|
656
699
|
### Apache Spark
|
657
700
|
|
658
701
|
Add [hexspace](https://github.com/ankane/hexspace) to your Gemfile and set:
|
@@ -668,7 +711,7 @@ Use a read-only user. Requires the [Thrift server](https://spark.apache.org/docs
|
|
668
711
|
|
669
712
|
### Cassandra
|
670
713
|
|
671
|
-
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:
|
672
715
|
|
673
716
|
```yml
|
674
717
|
data_sources:
|
@@ -676,6 +719,8 @@ data_sources:
|
|
676
719
|
url: cassandra://user:password@hostname:9042/keyspace
|
677
720
|
```
|
678
721
|
|
722
|
+
Use a [read-only role](https://docs.datastax.com/en/cql-oss/3.3/cql/cql_using/useSecurePermission.html).
|
723
|
+
|
679
724
|
### Druid
|
680
725
|
|
681
726
|
Enable [SQL support](http://druid.io/docs/latest/querying/sql.html#configuration) on the broker and set:
|
@@ -687,9 +732,11 @@ data_sources:
|
|
687
732
|
url: http://hostname:8082
|
688
733
|
```
|
689
734
|
|
735
|
+
Use a [read-only role](https://druid.apache.org/docs/latest/development/extensions-core/druid-basic-security.html).
|
736
|
+
|
690
737
|
### Elasticsearch
|
691
738
|
|
692
|
-
Add [elasticsearch](https://github.com/elastic/elasticsearch-ruby)
|
739
|
+
Add [elasticsearch](https://github.com/elastic/elasticsearch-ruby) to your Gemfile and set:
|
693
740
|
|
694
741
|
```yml
|
695
742
|
data_sources:
|
@@ -698,6 +745,8 @@ data_sources:
|
|
698
745
|
url: http://user:password@hostname:9200
|
699
746
|
```
|
700
747
|
|
748
|
+
Use a [read-only role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-privileges.html).
|
749
|
+
|
701
750
|
### Google BigQuery
|
702
751
|
|
703
752
|
Add [google-cloud-bigquery](https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/google-cloud-bigquery) to your Gemfile and set:
|
@@ -720,6 +769,8 @@ data_sources:
|
|
720
769
|
url: ibm-db://user:password@hostname:50000/database
|
721
770
|
```
|
722
771
|
|
772
|
+
Use a [read-only user](https://www.ibm.com/support/pages/creating-read-only-database-permissions-user).
|
773
|
+
|
723
774
|
### InfluxDB
|
724
775
|
|
725
776
|
Add [influxdb](https://github.com/influxdata/influxdb-ruby) to your Gemfile and set:
|
@@ -731,10 +782,12 @@ data_sources:
|
|
731
782
|
url: http://user:password@hostname:8086/database
|
732
783
|
```
|
733
784
|
|
734
|
-
Supports [InfluxQL](https://docs.influxdata.com/influxdb/v1.8/query_language/explore-data/)
|
785
|
+
Use a [read-only user](https://docs.influxdata.com/influxdb/v1.8/administration/authentication_and_authorization/). Supports [InfluxQL](https://docs.influxdata.com/influxdb/v1.8/query_language/explore-data/).
|
735
786
|
|
736
787
|
### MongoDB
|
737
788
|
|
789
|
+
*Requires MongoDB < 4.2 at the moment*
|
790
|
+
|
738
791
|
Add [mongo](https://github.com/mongodb/mongo-ruby-driver) to your Gemfile and set:
|
739
792
|
|
740
793
|
```yml
|
@@ -743,6 +796,8 @@ data_sources:
|
|
743
796
|
url: mongodb://user:password@hostname:27017/database
|
744
797
|
```
|
745
798
|
|
799
|
+
Use a [read-only user](#mongodb).
|
800
|
+
|
746
801
|
### MySQL
|
747
802
|
|
748
803
|
Add [mysql2](https://github.com/brianmario/mysql2) to your Gemfile (if it’s not there) and set:
|
@@ -753,6 +808,8 @@ data_sources:
|
|
753
808
|
url: mysql2://user:password@hostname:3306/database
|
754
809
|
```
|
755
810
|
|
811
|
+
Use a [read-only user](#mysql).
|
812
|
+
|
756
813
|
### Neo4j
|
757
814
|
|
758
815
|
Add [neo4j-core](https://github.com/neo4jrb/neo4j-core) to your Gemfile and set:
|
@@ -764,6 +821,21 @@ data_sources:
|
|
764
821
|
url: http://user:password@hostname:7474
|
765
822
|
```
|
766
823
|
|
824
|
+
Use a [read-only user](https://neo4j.com/docs/cypher-manual/current/access-control/manage-privileges/).
|
825
|
+
|
826
|
+
### OpenSearch
|
827
|
+
|
828
|
+
Add [opensearch-ruby](https://github.com/opensearch-project/opensearch-ruby) to your Gemfile and set:
|
829
|
+
|
830
|
+
```yml
|
831
|
+
data_sources:
|
832
|
+
my_source:
|
833
|
+
adapter: opensearch
|
834
|
+
url: http://user:password@hostname:9200
|
835
|
+
```
|
836
|
+
|
837
|
+
Use a [read-only user](https://opensearch.org/docs/latest/security-plugin/access-control/permissions/).
|
838
|
+
|
767
839
|
### Oracle
|
768
840
|
|
769
841
|
Add [activerecord-oracle_enhanced-adapter](https://github.com/rsim/oracle-enhanced) and [ruby-oci8](https://github.com/kubo/ruby-oci8) to your Gemfile and set:
|
@@ -774,6 +846,8 @@ data_sources:
|
|
774
846
|
url: oracle-enhanced://user:password@hostname:1521/database
|
775
847
|
```
|
776
848
|
|
849
|
+
Use a [read-only user](https://docs.oracle.com/cd/B19306_01/network.102/b14266/authoriz.htm).
|
850
|
+
|
777
851
|
### PostgreSQL
|
778
852
|
|
779
853
|
Add [pg](https://github.com/ged/ruby-pg) to your Gemfile (if it’s not there) and set:
|
@@ -784,6 +858,8 @@ data_sources:
|
|
784
858
|
url: postgres://user:password@hostname:5432/database
|
785
859
|
```
|
786
860
|
|
861
|
+
Use a [read-only user](#postgresql).
|
862
|
+
|
787
863
|
### Presto
|
788
864
|
|
789
865
|
Add [presto-client](https://github.com/treasure-data/presto-client-ruby) to your Gemfile and set:
|
@@ -794,6 +870,8 @@ data_sources:
|
|
794
870
|
url: presto://user@hostname:8080/catalog
|
795
871
|
```
|
796
872
|
|
873
|
+
Use a [read-only user](https://prestodb.io/docs/current/security/built-in-system-access-control.html).
|
874
|
+
|
797
875
|
### Salesforce
|
798
876
|
|
799
877
|
Add [restforce](https://github.com/restforce/restforce) to your Gemfile and set:
|
@@ -815,7 +893,7 @@ SALESFORCE_CLIENT_SECRET="client secret"
|
|
815
893
|
SALESFORCE_API_VERSION="41.0"
|
816
894
|
```
|
817
895
|
|
818
|
-
Supports [SOQL](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm)
|
896
|
+
Use a read-only user. Supports [SOQL](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm).
|
819
897
|
|
820
898
|
### Socrata Open Data API (SODA)
|
821
899
|
|
@@ -829,7 +907,7 @@ data_sources:
|
|
829
907
|
app_token: ...
|
830
908
|
```
|
831
909
|
|
832
|
-
Supports [SoQL](https://dev.socrata.com/docs/functions/)
|
910
|
+
Supports [SoQL](https://dev.socrata.com/docs/functions/).
|
833
911
|
|
834
912
|
### Snowflake
|
835
913
|
|
@@ -863,6 +941,8 @@ data_sources:
|
|
863
941
|
conn_str: Driver=/path/to/libSnowflake.so;uid=user;pwd=password;server=host.snowflakecomputing.com
|
864
942
|
```
|
865
943
|
|
944
|
+
Use a [read-only role](https://docs.snowflake.com/en/user-guide/security-access-control-configure.html).
|
945
|
+
|
866
946
|
### SQLite
|
867
947
|
|
868
948
|
Add [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) to your Gemfile and set:
|
@@ -883,6 +963,8 @@ data_sources:
|
|
883
963
|
url: sqlserver://user:password@hostname:1433/database
|
884
964
|
```
|
885
965
|
|
966
|
+
Use a [read-only user](https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/getting-started-with-database-engine-permissions?view=sql-server-ver15).
|
967
|
+
|
886
968
|
## Creating an Adapter
|
887
969
|
|
888
970
|
Create an adapter for any data store with:
|
@@ -959,6 +1041,22 @@ override_csp: true
|
|
959
1041
|
|
960
1042
|
## Upgrading
|
961
1043
|
|
1044
|
+
### 2.6
|
1045
|
+
|
1046
|
+
Custom adapters now need to specify how to quote variables in queries (there is no longer a default)
|
1047
|
+
|
1048
|
+
```ruby
|
1049
|
+
class FooAdapter < Blazer::Adapters::BaseAdapter
|
1050
|
+
def quoting
|
1051
|
+
:backslash_escape # single quote strings and convert ' to \' and \ to \\
|
1052
|
+
# or
|
1053
|
+
:single_quote_escape # single quote strings and convert ' to ''
|
1054
|
+
# or
|
1055
|
+
->(value) { ... } # custom method
|
1056
|
+
end
|
1057
|
+
end
|
1058
|
+
```
|
1059
|
+
|
962
1060
|
### 2.3
|
963
1061
|
|
964
1062
|
To archive queries, create a migration
|