Fork me on GitHub

Alf — Relational Algebra at your Fingertips

Alf provides you with the relational algebra in Shell and in Ruby. It is a successful meeting between:

Example

#
# What is the total weight of supplied products,     
# by city, then by product id?                    
#                                                 
(group                                            +--------+---------------------+
  (summarize (join :parts, :supplies),            | :city  | :supplying          |
    [:city, :pid],                                +--------+---------------------+
    :total => sum{ weight * qty }),               | London | +------+---------+  |
  [:pid, :total], :supplying)                     |        | | :pid | :total  |  |
                                                  |        | +------+---------+  |
                                                  |        | | P1   | 7200.00 |  |
                                                  |        | | P4   | 7000.00 |  |
                                                  |        | | P6   | 1900.00 |  |
                                                  | ...    | | ...  | ...     |  |

How to install?

Alf requires an installation of the Ruby programming language. We strongly recommend using ruby 1.9.2. If you are under windows or if you are familiar with Java, have a look at JRuby, it's simple to install and easy to use.

Then, the gem command is bundled with your Ruby installation and allows automatically installing alf and its dependencies:

[sudo] gem install alf [fastercsv] [sequel] [sqlite3 pg ...]

Where

Then ?

Tweet