You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Dilip Patel <dk...@gmail.com> on 2024/03/28 20:50:57 UTC

Question about exposing tables and columns

Hi

We have a data warehouse, and I want to expose only selected tables from
the DW and create a virtual database. I aim to allow the consumer to query
these tables via the JDBC driver. I came across the Calcite and Avatica
libraries and they seem to be capable of doing this.

I was able to connect to the Datawarehouse database and expose all the
tables and columns using Avatica running as a server. However, despite my
best efforts, I couldn't find a way to expose only certain tables and their
columns. Can you provide some examples of how to do this?

I have attached the code. I have implemented custom meta, but I am still
unable to invoke the getTables function (I believe it is called by the
Avatica framework itself )

So that you know, the implementation is just rough to get my feet wet with
Calcite and Avatica.

Thank you,
Dilip

Re: Question about exposing tables and columns

Posted by Francis Chuang <fr...@apache.org>.
Hey Dilip,

I don't think your attachment made it through, due to moderation. Can 
you try uploading it as a gist on GitHub?

Francis

On 29/03/2024 7:50 am, Dilip Patel wrote:
> Hi
> 
> We have a data warehouse, and I want to expose only selected tables from 
> the DW and create a virtual database. I aim to allow the consumer to 
> query these tables via the JDBC driver. I came across the Calcite and 
> Avatica libraries and they seem to be capable of doing this.
> 
> I was able to connect to the Datawarehouse database and expose all the 
> tables and columns using Avatica running as a server. However, despite 
> my best efforts, I couldn't find a way to expose only certain tables and 
> their columns. Can you provide some examples of how to do this?
> 
> I have attached the code. I have implemented custom meta, but I am still 
> unable to invoke the getTables function (I believe it is called by the 
> Avatica framework itself )
> 
> So that you know, the implementation is just rough to get my feet wet 
> with Calcite and Avatica.
> 
> Thank you,
> Dilip
> 

Re: Question about exposing tables and columns

Posted by Dilip Patel <dk...@gmail.com>.
Also here is the client-side code:

String sql = "select * from ddw_fact_realtime_metric";
Connection connection = null;
Statement statement = null;
try {
    connection =
DriverManager.getConnection("jdbc:avatica:remote:url=http://localhost:9787;serialization=PROTOBUF");
    statement = connection.createStatement();
    try {
        final ResultSet resultSet =
                statement.executeQuery(
                        sql);
        output(resultSet);
    }catch (Exception e)
    {
        e.printStackTrace();
    }

} finally {
    close(connection, statement);
}


On Thu, Mar 28, 2024 at 4:50 PM Dilip Patel <dk...@gmail.com> wrote:

> Hi
>
> We have a data warehouse, and I want to expose only selected tables from
> the DW and create a virtual database. I aim to allow the consumer to query
> these tables via the JDBC driver. I came across the Calcite and Avatica
> libraries and they seem to be capable of doing this.
>
> I was able to connect to the Datawarehouse database and expose all the
> tables and columns using Avatica running as a server. However, despite my
> best efforts, I couldn't find a way to expose only certain tables and their
> columns. Can you provide some examples of how to do this?
>
> I have attached the code. I have implemented custom meta, but I am still
> unable to invoke the getTables function (I believe it is called by the
> Avatica framework itself )
>
> So that you know, the implementation is just rough to get my feet wet with
> Calcite and Avatica.
>
> Thank you,
> Dilip
>
>