Alf
Relational Algebra at your fingertips
Links
Overview
Alf is a modern query language, rooted in relational algebra, and implemented as a Ruby Domain Specific Language. It is distributed as a consolidated ruby gem:
gem install alf
You'll also need the usual adapter gems for connecting to SQL engines, such as
pg
for PostgreSQL or sqlite3
for SQlite. I've not tested Alf against MySQL
and won't.
See the official documentation for getting started using Alf in Ruby and in Shell.
Detailed overview
The consolidated gem is assembled from the following components:
- alf-core core classes of Alf, algebra, memory engine, Relation, compiler, and so on. This is actually Alf itself, I would say.
- alf-sql extension of core's compiler to handle SQL compilation specifically, in an abstract way.
- alf-sequel an adapter for connecting to SQL DBMSs using Sequel.
- alf-shell implements the commandline tool that you can use without even knowing ruby.
- alf-rack a few Rack middlewares for using Alf in ruby web applications.
- alf-doc is the source of all the documentation found in man pages (shell) and on try-alf.org.
- try-alf is the source code of try-alf.org itself.
Those components are distributed as separated ruby gems as well. A typical ruby configuration (Gemfile) for using Alf and connecting to SQL databases is either:
# consolidated gem, possibly with a lot of uneeded dependencies.
gem "alf", "~> 0.15.0"
or
# take only those gems that you need, here for a web app connecting to SQL
# databases.
gem "alf-core", "~> 0.15.0" # you can even omit this one
gem "alf-sequel", "~> 0.15.0"
gem "alf-rack", "~> 0.15.0"
Contributing
As usual, on github, issues and pull requests, either on sub-projects (if you know where your issue/contribution fits) or on this one (if you don't).
Integration work on Alf requires having all components available. The scenario below might be a good way for getting started:
git clone git://github.com/alf-tool/alf.git
git submodule init
git submodule update
rake mod:test
rake test
Let me know if some tests fail in your environment. I'm not sure to know the idiomatic way to use github with submodules when clones are involved. If you do know, feel free to contribute your first pull request on this README ;-)