Or, better, the file adapter. It also handles CSV files and is not “toy” code. 

Julian

> On Sep 26, 2022, at 08:20, Michael Mior <[email protected]> wrote:
> 
> Do you have the calcite-csv package as a dependency of your project? This
> must be added in addition to calcite-core.
> --
> Michael Mior
> [email protected]
> 
> 
>> On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
>> <[email protected]> wrote:
>> 
>> Hi Calcite Developers,
>> 
>> I am working on a requirement where user queries to RDMS database and
>> under the hood, Calcite will send back the data from JSON, not from RDMS.
>> 
>> For this, I have added below code snippet in CalciteStatement execute
>> method to add CSV schema runtime.
>> 
>> sample code :
>> 
>> final Schema schema =
>>        CsvSchemaFactory.INSTANCE
>>            .create(connection.getRootSchema(), null,
>>                ImmutableMap.of("directory",
>>                    "EMPS.json", "flavor", "scannable"));
>> 
>>  connection.getRootSchema().add("mycsv", schema);
>> 
>> So, when the user query "SELECT * FROM <RDMS>.EMPS" converts to
>> "SELECT * FROM \"mycsv\".EMPS"
>> 
>> The above code says  *package org.apache.calcite.adapter.csv does not
>> exist,*
>> 
>> I am trying to fix it for 5 hours.
>> How to do this?
>> 
>> Regards,
>> Kartik
>> 

Reply via email to