Hi Sandeep,

I'm no expert so take what I'm saying with a grain of salt.

I use Calcite to generate queries by using the RelBuilder, which will
create RelNodes that I can then convert to SQL when I need to execute the
query.

>From my understanding, if we use Relational Algebra it's because it's much
easier to manipulate and reason with, than SQL. Therefore it makes more
sense for me to build the query using relational algebra and then convert
it back to SQL.

TL;DR: I don't use SQL Nodes to build queries, but RelBuilder then
RelToSQLConverter.

Hope this helps,

Florent

On Wed, Nov 24, 2021, 11:38 AM Sandeep Nayak <[email protected]>
wrote:

> Hello,
>
> I have been looking for a library which will allow me to use an object tree
> to generate a SQL. Calcite came up in my search but after taking a look at
> the codebase my conclusion is that Calcite provides the ability to parse
> SQL statements into an object tree represented as SQLNode (and derived
> classes) instances which subsequently can be used to perform optimizations
> by generating  relational algebra for the logical query.
>
> Calcite however does not provide classes which can be used to assemble a
> tree and generate SQL statements. From the contracts at least SQLNode takes
> in a Parser position and there are no other contracts which indicate such
> an option. Can someone confirm if this is inaccurate?
>
> If not Calcite, are there other open source libraries out there which allow
> this?
>
> Thanks in advance.
>
> -Sandeep
>

Reply via email to