You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Kartik Kudada <ka...@exate.com.INVALID> on 2022/09/26 14:36:46 UTC

mocking service for Database

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

Re: mocking service for Database

Posted by Kartik Kudada <ka...@exate.com.INVALID>.
Thanks Jullian ,

Yes, I am doing changes to the calcite code base (in core module,
CalciteStatement class), I will make jar and use it in tools like DBeaver
for different databases.

I will try either of the options suggested.


On Tue, Sep 27, 2022 at 12:46 AM Julian Hyde <jh...@apache.org> wrote:

> Kartik,
>
> You should make your own module that depends on both "core" and
> "file". In that way, no dependencies are circular.
>
> It sounds like you are hacking a fork of Calcite's git repo. If so,
> you could hack the 'plus' module, and make it depend on "file" and
> "core".
>
> Julian
>
> On Mon, Sep 26, 2022 at 10:05 AM Kartik Kudada
> <ka...@exate.com.invalid> wrote:
> >
> > Sorry typo error in the previous mail, the corrected part is highlighted.
> >
> > build.gradle.kts of file .
> >  line - 24
> >
> > dependencies {
> >     api(project(":core"))
> >
> >
> > On Mon, Sep 26, 2022 at 10:32 PM Kartik Kudada <ka...@exate.com>
> > wrote:
> >
> > >
> > > Hi Michael ,
> > >
> > > file module has core dependency.
> > >
> > > build.gradle.kts of core .
> > >  line - 24
> > >
> > > dependencies {
> > >     api(project(":core"))
> > >
> > >
> > > That's why when adding the below dependencies in core module, results
> in
> > > circular dependency ( message: Circular dependency between the
> following
> > > tasks: )
> > >
> > > api(project(":example"))
> > > api(project(":file"))
> > >
> > > If i add only example module  => No circular dependency
> > >
> > > If I add only file mobile         => circular dependency .
> > >
> > >
> > > Not sure how to fix that .
> > >
> > > Regards,
> > > Kartik
> > >
> > > On Mon, Sep 26, 2022 at 10:15 PM Michael Mior <mm...@apache.org>
> wrote:
> > >
> > >> Thanks Julian for correcting which package should be used. This is
> not a
> > >> circular dependency. There should be no problem with a dependency both
> > >> being required directly by your project and transitively via another
> > >> dependency. A circular dependency would be if the file adapter
> required
> > >> the
> > >> core code *and* the core code required the file adapter.
> > >>
> > >> --
> > >> Michael Mior
> > >> mmior@apache.org
> > >>
> > >>
> > >> On Mon, Sep 26, 2022 at 12:03 PM Kartik Kudada
> > >> <ka...@exate.com.invalid> wrote:
> > >>
> > >> > Thanks for the quick response.
> > >> >
> > >> >  org.apache.calcite.adapter.csv is in the file module.
> > >> > I tried to add example and file module in core's build.gradle.kts
> but
> > >> that
> > >> > results in circular dependency as file's build.gradle.kts also has
> core
> > >> > dependency.
> > >> >
> > >> > Core's build.gradle.kts
> > >> >
> > >> > api(project(":example"))
> > >> > api(project(":file"))
> > >> >
> > >> >
> > >> > Regards,
> > >> >
> > >> > Kartik
> > >> >
> > >> >
> > >> >
> > >> > On Mon, Sep 26, 2022 at 9:18 PM Julian Hyde <jhyde.apache@gmail.com
> >
> > >> > wrote:
> > >> >
> > >> > > 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 <mm...@apache.org>
> 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
> > >> > > > mmior@apache.org
> > >> > > >
> > >> > > >
> > >> > > >> On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
> > >> > > >> <ka...@exate.com.invalid> 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
> > >> > > >>
> > >> > >
> > >> >
> > >>
> > >
>

Re: mocking service for Database

Posted by Julian Hyde <jh...@apache.org>.
Kartik,

You should make your own module that depends on both "core" and
"file". In that way, no dependencies are circular.

It sounds like you are hacking a fork of Calcite's git repo. If so,
you could hack the 'plus' module, and make it depend on "file" and
"core".

Julian

On Mon, Sep 26, 2022 at 10:05 AM Kartik Kudada
<ka...@exate.com.invalid> wrote:
>
> Sorry typo error in the previous mail, the corrected part is highlighted.
>
> build.gradle.kts of file .
>  line - 24
>
> dependencies {
>     api(project(":core"))
>
>
> On Mon, Sep 26, 2022 at 10:32 PM Kartik Kudada <ka...@exate.com>
> wrote:
>
> >
> > Hi Michael ,
> >
> > file module has core dependency.
> >
> > build.gradle.kts of core .
> >  line - 24
> >
> > dependencies {
> >     api(project(":core"))
> >
> >
> > That's why when adding the below dependencies in core module, results in
> > circular dependency ( message: Circular dependency between the following
> > tasks: )
> >
> > api(project(":example"))
> > api(project(":file"))
> >
> > If i add only example module  => No circular dependency
> >
> > If I add only file mobile         => circular dependency .
> >
> >
> > Not sure how to fix that .
> >
> > Regards,
> > Kartik
> >
> > On Mon, Sep 26, 2022 at 10:15 PM Michael Mior <mm...@apache.org> wrote:
> >
> >> Thanks Julian for correcting which package should be used. This is not a
> >> circular dependency. There should be no problem with a dependency both
> >> being required directly by your project and transitively via another
> >> dependency. A circular dependency would be if the file adapter required
> >> the
> >> core code *and* the core code required the file adapter.
> >>
> >> --
> >> Michael Mior
> >> mmior@apache.org
> >>
> >>
> >> On Mon, Sep 26, 2022 at 12:03 PM Kartik Kudada
> >> <ka...@exate.com.invalid> wrote:
> >>
> >> > Thanks for the quick response.
> >> >
> >> >  org.apache.calcite.adapter.csv is in the file module.
> >> > I tried to add example and file module in core's build.gradle.kts but
> >> that
> >> > results in circular dependency as file's build.gradle.kts also has core
> >> > dependency.
> >> >
> >> > Core's build.gradle.kts
> >> >
> >> > api(project(":example"))
> >> > api(project(":file"))
> >> >
> >> >
> >> > Regards,
> >> >
> >> > Kartik
> >> >
> >> >
> >> >
> >> > On Mon, Sep 26, 2022 at 9:18 PM Julian Hyde <jh...@gmail.com>
> >> > wrote:
> >> >
> >> > > 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 <mm...@apache.org> 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
> >> > > > mmior@apache.org
> >> > > >
> >> > > >
> >> > > >> On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
> >> > > >> <ka...@exate.com.invalid> 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
> >> > > >>
> >> > >
> >> >
> >>
> >

Re: mocking service for Database

Posted by Kartik Kudada <ka...@exate.com.INVALID>.
Sorry typo error in the previous mail, the corrected part is highlighted.

build.gradle.kts of file .
 line - 24

dependencies {
    api(project(":core"))


On Mon, Sep 26, 2022 at 10:32 PM Kartik Kudada <ka...@exate.com>
wrote:

>
> Hi Michael ,
>
> file module has core dependency.
>
> build.gradle.kts of core .
>  line - 24
>
> dependencies {
>     api(project(":core"))
>
>
> That's why when adding the below dependencies in core module, results in
> circular dependency ( message: Circular dependency between the following
> tasks: )
>
> api(project(":example"))
> api(project(":file"))
>
> If i add only example module  => No circular dependency
>
> If I add only file mobile         => circular dependency .
>
>
> Not sure how to fix that .
>
> Regards,
> Kartik
>
> On Mon, Sep 26, 2022 at 10:15 PM Michael Mior <mm...@apache.org> wrote:
>
>> Thanks Julian for correcting which package should be used. This is not a
>> circular dependency. There should be no problem with a dependency both
>> being required directly by your project and transitively via another
>> dependency. A circular dependency would be if the file adapter required
>> the
>> core code *and* the core code required the file adapter.
>>
>> --
>> Michael Mior
>> mmior@apache.org
>>
>>
>> On Mon, Sep 26, 2022 at 12:03 PM Kartik Kudada
>> <ka...@exate.com.invalid> wrote:
>>
>> > Thanks for the quick response.
>> >
>> >  org.apache.calcite.adapter.csv is in the file module.
>> > I tried to add example and file module in core's build.gradle.kts but
>> that
>> > results in circular dependency as file's build.gradle.kts also has core
>> > dependency.
>> >
>> > Core's build.gradle.kts
>> >
>> > api(project(":example"))
>> > api(project(":file"))
>> >
>> >
>> > Regards,
>> >
>> > Kartik
>> >
>> >
>> >
>> > On Mon, Sep 26, 2022 at 9:18 PM Julian Hyde <jh...@gmail.com>
>> > wrote:
>> >
>> > > 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 <mm...@apache.org> 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
>> > > > mmior@apache.org
>> > > >
>> > > >
>> > > >> On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
>> > > >> <ka...@exate.com.invalid> 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
>> > > >>
>> > >
>> >
>>
>

Re: mocking service for Database

Posted by Kartik Kudada <ka...@exate.com.INVALID>.
Hi Michael ,

file module has core dependency.

build.gradle.kts of core .
 line - 24

dependencies {
    api(project(":core"))


That's why when adding the below dependencies in core module, results in
circular dependency ( message: Circular dependency between the following
tasks: )

api(project(":example"))
api(project(":file"))

If i add only example module  => No circular dependency

If I add only file mobile         => circular dependency .


Not sure how to fix that .

Regards,
Kartik

On Mon, Sep 26, 2022 at 10:15 PM Michael Mior <mm...@apache.org> wrote:

> Thanks Julian for correcting which package should be used. This is not a
> circular dependency. There should be no problem with a dependency both
> being required directly by your project and transitively via another
> dependency. A circular dependency would be if the file adapter required the
> core code *and* the core code required the file adapter.
>
> --
> Michael Mior
> mmior@apache.org
>
>
> On Mon, Sep 26, 2022 at 12:03 PM Kartik Kudada
> <ka...@exate.com.invalid> wrote:
>
> > Thanks for the quick response.
> >
> >  org.apache.calcite.adapter.csv is in the file module.
> > I tried to add example and file module in core's build.gradle.kts but
> that
> > results in circular dependency as file's build.gradle.kts also has core
> > dependency.
> >
> > Core's build.gradle.kts
> >
> > api(project(":example"))
> > api(project(":file"))
> >
> >
> > Regards,
> >
> > Kartik
> >
> >
> >
> > On Mon, Sep 26, 2022 at 9:18 PM Julian Hyde <jh...@gmail.com>
> > wrote:
> >
> > > 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 <mm...@apache.org> 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
> > > > mmior@apache.org
> > > >
> > > >
> > > >> On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
> > > >> <ka...@exate.com.invalid> 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
> > > >>
> > >
> >
>

Re: mocking service for Database

Posted by Michael Mior <mm...@apache.org>.
Thanks Julian for correcting which package should be used. This is not a
circular dependency. There should be no problem with a dependency both
being required directly by your project and transitively via another
dependency. A circular dependency would be if the file adapter required the
core code *and* the core code required the file adapter.

--
Michael Mior
mmior@apache.org


On Mon, Sep 26, 2022 at 12:03 PM Kartik Kudada
<ka...@exate.com.invalid> wrote:

> Thanks for the quick response.
>
>  org.apache.calcite.adapter.csv is in the file module.
> I tried to add example and file module in core's build.gradle.kts but that
> results in circular dependency as file's build.gradle.kts also has core
> dependency.
>
> Core's build.gradle.kts
>
> api(project(":example"))
> api(project(":file"))
>
>
> Regards,
>
> Kartik
>
>
>
> On Mon, Sep 26, 2022 at 9:18 PM Julian Hyde <jh...@gmail.com>
> wrote:
>
> > 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 <mm...@apache.org> 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
> > > mmior@apache.org
> > >
> > >
> > >> On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
> > >> <ka...@exate.com.invalid> 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
> > >>
> >
>

Re: mocking service for Database

Posted by Kartik Kudada <ka...@exate.com.INVALID>.
Thanks for the quick response.

 org.apache.calcite.adapter.csv is in the file module.
I tried to add example and file module in core's build.gradle.kts but that
results in circular dependency as file's build.gradle.kts also has core
dependency.

Core's build.gradle.kts

api(project(":example"))
api(project(":file"))


Regards,

Kartik



On Mon, Sep 26, 2022 at 9:18 PM Julian Hyde <jh...@gmail.com> wrote:

> 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 <mm...@apache.org> 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
> > mmior@apache.org
> >
> >
> >> On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
> >> <ka...@exate.com.invalid> 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
> >>
>

Re: mocking service for Database

Posted by Julian Hyde <jh...@gmail.com>.
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 <mm...@apache.org> 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
> mmior@apache.org
> 
> 
>> On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
>> <ka...@exate.com.invalid> 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
>> 

Re: mocking service for Database

Posted by Michael Mior <mm...@apache.org>.
Do you have the calcite-csv package as a dependency of your project? This
must be added in addition to calcite-core.
--
Michael Mior
mmior@apache.org


On Mon, Sep 26, 2022 at 10:37 AM Kartik Kudada
<ka...@exate.com.invalid> 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
>