Skip to content

Commit

Permalink
Continuing the readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Mayr committed Mar 22, 2012
1 parent 2cb9d14 commit 9f1cc29
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions README.md
Expand Up @@ -3,6 +3,65 @@ Switch - A Query Language for Ruby


More to come ... 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) * [A Deep Embedding of Queries into Ruby](http://db.inf.uni-tuebingen.de/files/publications/off-the-beaten-track.pdf)
Torsten Grust, Manuel Mayr. Torsten Grust, Manuel Mayr.
In Proceedings of the 28th IEEE International Conference on Data Engineering (ICDE 2012), Washington, DC, USA, April 2012. 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.