Business intelligence made simple
Added MongoDB and Elasticsearch to docs
Andrew Kanefc43b9868c5e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 29e96f2a..4dc315fb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,7 +1,7 @@## 1.6.0 [unreleased]-- Added support for MongoDB-- Added support for Elasticsearch+- Added support for MongoDB [beta]+- Added support for Elasticsearch [beta]- Fixed deprecation warning in Rails 5## 1.5.1diff --git a/README.md b/README.mdindex 761c49e8..80f9ab59 100644--- a/README.md+++ b/README.md@@ -355,15 +355,48 @@ data_sources:- Oracle- IBM DB2 and Informix- SQLite+- MongoDB [beta]+- Elasticsearch [beta]You can also create an adapter for any other data store.+**Note:** In the examples below, we recommend using environment variables for urls.++```yml+data_sources:+ my_source:+ url: <%= ENV["BLAZER_MY_SOURCE_URL"] %>+```+### RedshiftAdd [activerecord4-redshift-adapter](https://github.com/aamine/activerecord4-redshift-adapter) to your Gemfile and set:-```ruby-ENV["BLAZER_DATABASE_URL"] = "redshift://user:password@hostname:5439/database"+```yml+data_sources:+ my_source:+ url: redshift://user:password@hostname:5439/database+```++### MongoDB++Add [mongo](https://github.com/mongodb/mongo-ruby-driver) to your Gemfile and set:++```yml+data_sources:+ my_source:+ url: mongodb://user:password@hostname:27017/database+```++### Elasticsearch++Add [elasticsearch](https://github.com/elastic/elasticsearch-ruby) to your Gemfile and set:++```yml+data_sources:+ my_source:+ adapter: elasticsearch+ url: http://user:password@hostname:9200/```## Learn SQLdiff --git a/lib/blazer/data_source.rb b/lib/blazer/data_source.rbindex e98f8877..6e4f0687 100644--- a/lib/blazer/data_source.rb+++ b/lib/blazer/data_source.rb@@ -30,7 +30,7 @@ module Blazerenddef adapter- settings["adapter"] || "sql"+ settings["adapter"] || detect_adapterenddef name@@ -176,5 +176,13 @@ module BlazerBlazer::Result.new(self, columns, rows, error, nil, cache && !cache_data.nil?)end++ def detect_adapter+ if settings["url"].to_s.start_with?("mongodb://")+ "mongodb"+ else+ "sql"+ end+ endendend