Factor tutorial out of readme, and add sections on JDBC schema and clone schema adapters.
2 files changed
tree: 40d84697500b4759ac51392f70ed3c46ef19edbe
  1. src/
  2. .gitignore
  3. LICENSE
  4. NOTICE
  5. pom.xml
  6. README.md
  7. sqlline
  8. TUTORIAL.md
README.md

optiq-csv

Optiq adapter that reads CSV files.

Optiq-csv is a nice simple example of how to connect Optiq to your own data source and quickly get a full SQL/JDBC interface.

Download and build

You need Java (1.5 or higher; 1.7 preferred) and maven (2 or higher).

$ git clone git://github.com/julianhyde/optiq-csv.git
$ cd optiq-csv
$ mvn compile

Run sqlline

Sqlline is a shell that connects to any JDBC data source and lets you execute SQL queries. Connect to Optiq and try out some queries.

$ ./sqlline
sqlline> !connect jdbc:optiq:model=target/test-classes/model.json admin admin
sqlline> !tables
sqlline> !describe emps
sqlline> SELECT * FROM emps;
sqlline> EXPLAIN PLAN FOR SELECT * FROM emps;
sqlline> !connect jdbc:optiq:model=target/test-classes/smart.json admin admin
sqlline> EXPLAIN PLAN FOR SELECT * FROM emps;
sqlline> SELECT depts.name, count(*)
. . . .> FROM emps JOIN depts USING (deptno)
. . . .> GROUP BY depts.name;
sqlline> VALUES char_length('hello, ' || 'world!');
sqlline> !quit

Advanced use

You can also register a CsvSchema as a schema within an Optiq instance. Then you can combine with other data sources.

You can write a “vanity JDBC driver” with a different name.

You can add optimizer rules and new implementations of relational operators to execute queries more efficiently.

More information