Apache Calcite - How to Integrate CSV and MySQL

431 Views Asked by At

It is easy to use each adapter by command connect.

for example: !connect jdbc:calcite:model=target/test-classes/model.json admin admin

but I have not found in documentation how to do queries involving heterogeneous sources.

I would like to do a query involving entities that are in the two sources, CSV and MySQL.

1

There are 1 best solutions below

0
On

You have to add two schemas in your in model.json file, one that targets CSV source and another one that targets JDBC MySQL source.

If the sources contain tables that are somehow connected, then you can create queries like this:

SELECT csv_source.table1.field1, mysql_source.table2.field2,
       csv_source.table1.joint_field, mysql_source.table2.joint_field
FROM csv_source.table1 
     JOIN mysql_source.table2 
          ON joint_field;