You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Andreas Eberhart <an...@gmail.com> on 2020/07/28 08:00:56 UTC

JDBC Config Options

Hi,

I'm new in the Calcite Community (hope this is the right place to ask this
kind of question).

It found the following options to configure Calcite JDBC clients so far:

This tutorial uses a JSON file:
jdbc:calcite:model=src/test/resources/model.json
https://calcite.apache.org/docs/tutorial.html
https://github.com/apache/calcite/blob/master/example/csv/src/test/resources/model.json


This StackOverflow answer uses options separated by semicolons directly in
the JDBC URL:
jdbc:calcite:schemaFactory=org.apache.calcite.adapter.csv.CsvSchemaFactory;
schema.directory=/path/to/csv/files
https://stackoverflow.com/questions/61695163/packaging-apache-calcite-csv-example-into-a-jdbc-driver


The background page constructs schema pojos directly:
https://calcite.apache.org/docs/
(I do not understand the purpose of the line "info.setProperty("lex",
"JAVA")" in the code)

Questions:

1) Are there other options?
2) Is there a summary of the different ways Calcite JDBC clients can be
configured?
3) Is there a best practise?
4) Can every connection option be expressed in all mechanisms?

Thanks!

Andi

Re: JDBC Config Options

Posted by Julian Hyde <jh...@gmail.com>.
The JSON schema files have the same information content as the model you’d build in “the POJO way” so you should be just fine.

Julian

> On Jul 28, 2020, at 23:06, Andreas Eberhart <an...@gmail.com> wrote:
> 
> Thanks for the pointers. We're building a system that lets you register
> multiple DBs (SQL & NoSQL) and compose queries graphically. The plan is to
> allow users to select some of the DBs and add them to a Calcite federation
> which in turn shows up as another DB. For this use case, I'd prefer not
> having to work with model files so we'll probably go with the Schema SPI /
> POJO way.
> 
> Cheers
> 
> Andi
> 
> 
>> Am Di., 28. Juli 2020 um 20:12 Uhr schrieb Julian Hyde <
>> jhyde.apache@gmail.com>:
>> 
>> I can’t quite tell whether Andreas wants to connect to Calcite via JDBC,
>> or have Calcite’s adapter connect to a JDBC source.
>> 
>> For the former, there is not much variation in connect string parameters
>> available. Any of the parameters can be put into the “info” map or included
>> as part of the URL. So, using the “lex” property as an example,
>> 
>>  info.set(“lex”, “JAVA”);
>> 
>> is the same as adding
>> 
>>  “&lex=JAVA” to the connect string.
>> 
>> For the latter, as Michael says, there is a lot of variation among
>> adapters.
>> 
>> Julian
>> 
>> 
>>>> On Jul 28, 2020, at 7:31 AM, Michael Mior <mm...@apache.org> wrote:
>>> 
>>> 1) The options specified in the connection string are unique to the
>>> specific adapter being used.
>>> 2) Unfortunately, I don't believe such a summary exists. (Although
>>> there is documentation on what can be in the model JSON file.)
>>> 3) Configuring with the connecting string is fine where possible, but
>>> some options cannot be configured this way. When you need to use one
>>> of those options, it makes sense to move to a JSON configuration.
>>> 4) No. Only simple options can be expressed as part of the connecting
>>> string which may or may not be sufficient for your use case.
>>> 
>>> --
>>> Michael Mior
>>> mmior@apache.org
>>> 
>>> Le mar. 28 juil. 2020 à 04:01, Andreas Eberhart
>>> <an...@gmail.com> a écrit :
>>>> 
>>>> Hi,
>>>> 
>>>> I'm new in the Calcite Community (hope this is the right place to ask
>> this
>>>> kind of question).
>>>> 
>>>> It found the following options to configure Calcite JDBC clients so far:
>>>> 
>>>> This tutorial uses a JSON file:
>>>> jdbc:calcite:model=src/test/resources/model.json
>>>> https://calcite.apache.org/docs/tutorial.html
>>>> 
>> https://github.com/apache/calcite/blob/master/example/csv/src/test/resources/model.json
>>>> 
>>>> 
>>>> This StackOverflow answer uses options separated by semicolons directly
>> in
>>>> the JDBC URL:
>>>> 
>> jdbc:calcite:schemaFactory=org.apache.calcite.adapter.csv.CsvSchemaFactory;
>>>> schema.directory=/path/to/csv/files
>>>> 
>> https://stackoverflow.com/questions/61695163/packaging-apache-calcite-csv-example-into-a-jdbc-driver
>>>> 
>>>> 
>>>> The background page constructs schema pojos directly:
>>>> https://calcite.apache.org/docs/
>>>> (I do not understand the purpose of the line "info.setProperty("lex",
>>>> "JAVA")" in the code)
>>>> 
>>>> Questions:
>>>> 
>>>> 1) Are there other options?
>>>> 2) Is there a summary of the different ways Calcite JDBC clients can be
>>>> configured?
>>>> 3) Is there a best practise?
>>>> 4) Can every connection option be expressed in all mechanisms?
>>>> 
>>>> Thanks!
>>>> 
>>>> Andi
>> 
>> 

Re: JDBC Config Options

Posted by Andreas Eberhart <an...@gmail.com>.
Thanks for the pointers. We're building a system that lets you register
multiple DBs (SQL & NoSQL) and compose queries graphically. The plan is to
allow users to select some of the DBs and add them to a Calcite federation
which in turn shows up as another DB. For this use case, I'd prefer not
having to work with model files so we'll probably go with the Schema SPI /
POJO way.

Cheers

Andi


Am Di., 28. Juli 2020 um 20:12 Uhr schrieb Julian Hyde <
jhyde.apache@gmail.com>:

> I can’t quite tell whether Andreas wants to connect to Calcite via JDBC,
> or have Calcite’s adapter connect to a JDBC source.
>
> For the former, there is not much variation in connect string parameters
> available. Any of the parameters can be put into the “info” map or included
> as part of the URL. So, using the “lex” property as an example,
>
>   info.set(“lex”, “JAVA”);
>
> is the same as adding
>
>   “&lex=JAVA” to the connect string.
>
> For the latter, as Michael says, there is a lot of variation among
> adapters.
>
> Julian
>
>
> > On Jul 28, 2020, at 7:31 AM, Michael Mior <mm...@apache.org> wrote:
> >
> > 1) The options specified in the connection string are unique to the
> > specific adapter being used.
> > 2) Unfortunately, I don't believe such a summary exists. (Although
> > there is documentation on what can be in the model JSON file.)
> > 3) Configuring with the connecting string is fine where possible, but
> > some options cannot be configured this way. When you need to use one
> > of those options, it makes sense to move to a JSON configuration.
> > 4) No. Only simple options can be expressed as part of the connecting
> > string which may or may not be sufficient for your use case.
> >
> > --
> > Michael Mior
> > mmior@apache.org
> >
> > Le mar. 28 juil. 2020 à 04:01, Andreas Eberhart
> > <an...@gmail.com> a écrit :
> >>
> >> Hi,
> >>
> >> I'm new in the Calcite Community (hope this is the right place to ask
> this
> >> kind of question).
> >>
> >> It found the following options to configure Calcite JDBC clients so far:
> >>
> >> This tutorial uses a JSON file:
> >> jdbc:calcite:model=src/test/resources/model.json
> >> https://calcite.apache.org/docs/tutorial.html
> >>
> https://github.com/apache/calcite/blob/master/example/csv/src/test/resources/model.json
> >>
> >>
> >> This StackOverflow answer uses options separated by semicolons directly
> in
> >> the JDBC URL:
> >>
> jdbc:calcite:schemaFactory=org.apache.calcite.adapter.csv.CsvSchemaFactory;
> >> schema.directory=/path/to/csv/files
> >>
> https://stackoverflow.com/questions/61695163/packaging-apache-calcite-csv-example-into-a-jdbc-driver
> >>
> >>
> >> The background page constructs schema pojos directly:
> >> https://calcite.apache.org/docs/
> >> (I do not understand the purpose of the line "info.setProperty("lex",
> >> "JAVA")" in the code)
> >>
> >> Questions:
> >>
> >> 1) Are there other options?
> >> 2) Is there a summary of the different ways Calcite JDBC clients can be
> >> configured?
> >> 3) Is there a best practise?
> >> 4) Can every connection option be expressed in all mechanisms?
> >>
> >> Thanks!
> >>
> >> Andi
>
>

Re: JDBC Config Options

Posted by Julian Hyde <jh...@gmail.com>.
I can’t quite tell whether Andreas wants to connect to Calcite via JDBC, or have Calcite’s adapter connect to a JDBC source.

For the former, there is not much variation in connect string parameters available. Any of the parameters can be put into the “info” map or included as part of the URL. So, using the “lex” property as an example,

  info.set(“lex”, “JAVA”);

is the same as adding

  “&lex=JAVA” to the connect string.

For the latter, as Michael says, there is a lot of variation among adapters.

Julian


> On Jul 28, 2020, at 7:31 AM, Michael Mior <mm...@apache.org> wrote:
> 
> 1) The options specified in the connection string are unique to the
> specific adapter being used.
> 2) Unfortunately, I don't believe such a summary exists. (Although
> there is documentation on what can be in the model JSON file.)
> 3) Configuring with the connecting string is fine where possible, but
> some options cannot be configured this way. When you need to use one
> of those options, it makes sense to move to a JSON configuration.
> 4) No. Only simple options can be expressed as part of the connecting
> string which may or may not be sufficient for your use case.
> 
> --
> Michael Mior
> mmior@apache.org
> 
> Le mar. 28 juil. 2020 à 04:01, Andreas Eberhart
> <an...@gmail.com> a écrit :
>> 
>> Hi,
>> 
>> I'm new in the Calcite Community (hope this is the right place to ask this
>> kind of question).
>> 
>> It found the following options to configure Calcite JDBC clients so far:
>> 
>> This tutorial uses a JSON file:
>> jdbc:calcite:model=src/test/resources/model.json
>> https://calcite.apache.org/docs/tutorial.html
>> https://github.com/apache/calcite/blob/master/example/csv/src/test/resources/model.json
>> 
>> 
>> This StackOverflow answer uses options separated by semicolons directly in
>> the JDBC URL:
>> jdbc:calcite:schemaFactory=org.apache.calcite.adapter.csv.CsvSchemaFactory;
>> schema.directory=/path/to/csv/files
>> https://stackoverflow.com/questions/61695163/packaging-apache-calcite-csv-example-into-a-jdbc-driver
>> 
>> 
>> The background page constructs schema pojos directly:
>> https://calcite.apache.org/docs/
>> (I do not understand the purpose of the line "info.setProperty("lex",
>> "JAVA")" in the code)
>> 
>> Questions:
>> 
>> 1) Are there other options?
>> 2) Is there a summary of the different ways Calcite JDBC clients can be
>> configured?
>> 3) Is there a best practise?
>> 4) Can every connection option be expressed in all mechanisms?
>> 
>> Thanks!
>> 
>> Andi


Re: JDBC Config Options

Posted by Michael Mior <mm...@apache.org>.
1) The options specified in the connection string are unique to the
specific adapter being used.
2) Unfortunately, I don't believe such a summary exists. (Although
there is documentation on what can be in the model JSON file.)
3) Configuring with the connecting string is fine where possible, but
some options cannot be configured this way. When you need to use one
of those options, it makes sense to move to a JSON configuration.
4) No. Only simple options can be expressed as part of the connecting
string which may or may not be sufficient for your use case.

--
Michael Mior
mmior@apache.org

Le mar. 28 juil. 2020 à 04:01, Andreas Eberhart
<an...@gmail.com> a écrit :
>
> Hi,
>
> I'm new in the Calcite Community (hope this is the right place to ask this
> kind of question).
>
> It found the following options to configure Calcite JDBC clients so far:
>
> This tutorial uses a JSON file:
> jdbc:calcite:model=src/test/resources/model.json
> https://calcite.apache.org/docs/tutorial.html
> https://github.com/apache/calcite/blob/master/example/csv/src/test/resources/model.json
>
>
> This StackOverflow answer uses options separated by semicolons directly in
> the JDBC URL:
> jdbc:calcite:schemaFactory=org.apache.calcite.adapter.csv.CsvSchemaFactory;
> schema.directory=/path/to/csv/files
> https://stackoverflow.com/questions/61695163/packaging-apache-calcite-csv-example-into-a-jdbc-driver
>
>
> The background page constructs schema pojos directly:
> https://calcite.apache.org/docs/
> (I do not understand the purpose of the line "info.setProperty("lex",
> "JAVA")" in the code)
>
> Questions:
>
> 1) Are there other options?
> 2) Is there a summary of the different ways Calcite JDBC clients can be
> configured?
> 3) Is there a best practise?
> 4) Can every connection option be expressed in all mechanisms?
>
> Thanks!
>
> Andi