Relational algebra SQL generator

Gem Version Build Status Dependency Status Code Climate Coverage Status


# visit every node in the relation AST
generator = Axiom::SQL::Generator::Relation.visit(relation)

# generate an SQL string
sql = generator.to_sql

# generate an SQL subquery string
subquery_sql = generator.to_subquery


The purpose of this gem is to produce valid SQL from a axiom relation. A relation is a representation of a query constructed using relational algebra organized into an AST. Each node in the AST corresponds to an operation defined in the algebra.

The SQL produced has been verified and tested against PostgreSQL 9.0.4. Dialects for MySQL, SQLite, Oracle and SQL Server are planned.


See for details.

Copyright © 2010-2013 Dan Kubb. See LICENSE for details.