README.md

# ExoSQL

**Not everything described here is working yet**

Universal SQL engine for Elixir.

This library implements the SQL logic to perform queries on user provided
databases using a simple interface based on Foreign Data Wrappers from
PostgreSQL.

This allows to use SQL on your own data.

For example it is included a CSV reader and an HTTP client, so that you can
do queries as:

```SQL
SELECT url, LENGTH(content), status_code
  FROM urls
  INNER JOIN http
  ON urls.url = http.url
```

## Installation

The package can be installed by adding `exosql` to your list of dependencies in
`mix.exs`:

```elixir
def deps do
  [
    {:exosql, "~> 0.1.0"}
  ]
end
```

## Features

* SELECT over external databases
* SELECT over several tables
* WHERE
* GROUP BY
* Some aggregation functions: COUNT, SUM, AVG

Check the tests for current features available.

## INNER JOIN [WIP]

Because some columns may need to be autogenerated depending on the query,
if you want to access those columns you may need to use INNER JOINS. This
way the planner asks for those specific column values.

For example:

```SQL
SELECT * FROM http
```

does not know to which URL you want to access, but:

```SQL
SELECT * FROM http WHERE url = 'http://serverboards.io'
```

knows the URL and can get the data.

Teh same way, on INNER JOINS this can be used to access to autogenerated data:

```SQL
SELECT url, LENGTH(content), status_code
  FROM urls
  INNER JOIN http
  ON urls.url = http.url
```