You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by KimJohn Quinn <kj...@logicdrop.com> on 2021/02/24 20:42:54 UTC
Question about multiple queries through REST API
Hello everyone.
We just started integrating Drill for a POC (i.e. embedded). Through a
REST API a user can submit one or more queries which in turn are sent to
Drill via its own REST API (/query.json).
How can I submit multiple queries where the current query may be
dependent on the previous one?
As an example:
1. use fsfile.`default`;
2. select t1.code, t2.name
from `dataFile1.psv` t1
join `dataFile2.psv` t2
on t1.code=t2.code;
Can I do this through the REST API or should I be using the JDBC API
directly instead to allow for multiple statements to be executed?
Thanks.
Re: Question about multiple queries through REST API
Posted by Prabhakar Bhosaale <bh...@gmail.com>.
Hi,
ANother way is to concat tablename to the schema name as follows
select t1.code, t2.name
from fsfile.default.`dataFile1.psv` t1
join fsfile.default.`dataFile2.psv` t2
on t1.code=t2.code;
Regards
Prabhakar
On Thu, Feb 25, 2021 at 2:41 AM Charles Givre <cg...@gmail.com> wrote:
> HI there,
> I don't think the Drill REST API accepts multiple queries in one request.
> However there is an alternative which doesn't appear to be in the
> documentation. When you submit your query there is a parameter called
> defaultSchema (I think) that you can set that has the effect of executing a
> USE statement prior to the query. That will accomplish what you're trying
> to do there.
>
> Best,
> -- C
>
> > On Feb 24, 2021, at 3:42 PM, KimJohn Quinn <kj...@logicdrop.com> wrote:
> >
> > Hello everyone.
> > We just started integrating Drill for a POC (i.e. embedded). Through a
> > REST API a user can submit one or more queries which in turn are sent to
> > Drill via its own REST API (/query.json).
> >
> > How can I submit multiple queries where the current query may be
> > dependent on the previous one?
> >
> > As an example:
> >
> > 1. use fsfile.`default`;
> >
> > 2. select t1.code, t2.name
> > from `dataFile1.psv` t1
> > join `dataFile2.psv` t2
> > on t1.code=t2.code;
> >
> > Can I do this through the REST API or should I be using the JDBC API
> > directly instead to allow for multiple statements to be executed?
> >
> > Thanks.
>
>
Re: Question about multiple queries through REST API
Posted by Charles Givre <cg...@gmail.com>.
HI there,
I don't think the Drill REST API accepts multiple queries in one request. However there is an alternative which doesn't appear to be in the documentation. When you submit your query there is a parameter called defaultSchema (I think) that you can set that has the effect of executing a USE statement prior to the query. That will accomplish what you're trying to do there.
Best,
-- C
> On Feb 24, 2021, at 3:42 PM, KimJohn Quinn <kj...@logicdrop.com> wrote:
>
> Hello everyone.
> We just started integrating Drill for a POC (i.e. embedded). Through a
> REST API a user can submit one or more queries which in turn are sent to
> Drill via its own REST API (/query.json).
>
> How can I submit multiple queries where the current query may be
> dependent on the previous one?
>
> As an example:
>
> 1. use fsfile.`default`;
>
> 2. select t1.code, t2.name
> from `dataFile1.psv` t1
> join `dataFile2.psv` t2
> on t1.code=t2.code;
>
> Can I do this through the REST API or should I be using the JDBC API
> directly instead to allow for multiple statements to be executed?
>
> Thanks.