Permalink
Browse files

Continuing the readme file

  • Loading branch information...
1 parent 2cb9d14 commit 9f1cc29fcb4c2f34f13240fd93453ed36a49cee1 Manuel Mayr committed Mar 22, 2012
Showing with 59 additions and 0 deletions.
  1. +59 −0 README.md
View
59 README.md
@@ -3,6 +3,65 @@ Switch - A Query Language for Ruby
More to come ...
+Installation
+------------
+
+### Setting up Pathfinder
+The relational algebra plans provided by **Switch** are usually too unwiedly to be handled directly by database systems. We rely thus on [Pathfinder](http://db.inf.uni-tuebingen.de/research/pathfinder/download) to optimize the plans in
+order to get efficient SQL-Code.
+
+### Download Switch
+Just get a clone of **Switch** ``
+git clone git@github.com:manuelmayr/Switch.git
+``
+and run `rake package` in the **Switch** directory.
+
+A simple ``gem install ./pkg/switch-0.0.1.gem`` completes the installation
+and takes care of the dependencies.
+
+
+Examples
+--------
+Use the following snippet as IRB initialization file ``$ irb -f irb_init.rb`` to play aroung with **Switch**.
+
+Switch uses **ActiveRecord** merely as infrastructure to interact with different database systems. **ActiveRecord** is thus *not involved* in the translation scheme we are using. The queries generated by **Switch** are dumped to `/tmp/switch.log`.
+
+
+```
+# filename: irb_init.rb
+require "switch"
+require "logger"
+
+include Switch
+Queryable.engine = Engine.new ActiveRecord::Base
+
+ActiveRecord::Base.logger = Logger.new("/tmp/switch.log")
+ActiveRecord::Base.logger.level = Logger::DEBUG
+ActiveRecord::Base.logger.datetime_format = "%Y-%m-%d %H:%M:%S"
+
+ActiveRecord::Base.configurations = {
+ 'pg' => {
+ :username => '<username>',
+ :password => '<password>'
+ :adapter => :postgresql,
+ :encoding => 'utf8',
+ :database => '<database>'
+ },
+ 'db2' => {
+ :username => '<username>',
+ :password => '<password>'
+ :adapter => :ibm_db,
+ :encoding => 'utf8',
+ :database => '<database>'
+ },
+}
+
+
+ActiveRecord::Base.establish_connection 'db2' # for DB2 or pg for postgres
+```
+
+References
+----------
* [A Deep Embedding of Queries into Ruby](http://db.inf.uni-tuebingen.de/files/publications/off-the-beaten-track.pdf)
Torsten Grust, Manuel Mayr.
In Proceedings of the 28th IEEE International Conference on Data Engineering (ICDE 2012), Washington, DC, USA, April 2012.

0 comments on commit 9f1cc29

Please sign in to comment.