The connect with a semi-colon doesn't show the schema info in the sqllline prompt unlike that with a colon. And neither can list 'show tables' unless 'use <database>' is executed first.
[root@n69 bin]# ./sqlline -u jdbc:drill:zk=n69:5181,n72:5181,n73:5181 ;schema=sys -n admin -p admin sqlline version 1.1.6 0: jdbc:drill:zk=n69:5181,n72:5181,n73:5181> show tables; Query failed: Failure while parsing sql. No schema selected. Select a schema using 'USE schema' command [94af55f3-c8ae-4a81-86f8-f64526e5e44c] Error: exception while executing query: Failure while trying to get next result batch. (state=,code=0) [root@n69 bin]# ./sqlline -u jdbc:drill:schema=sys:zk=n69:5181,n72:5181,n73:5181 -n admin -p admin sqlline version 1.1.6 0: jdbc:drill:schema=sys:zk=n69:5181,n72:5181> show tables; Query failed: Failure while parsing sql. No schema selected. Select a schema using 'USE schema' command [e8f6a2d3-0dd5-4c2b-bd11-3b1128aca643] Error: exception while executing query: Failure while trying to get next result batch. (state=,code=0) --- Mufeed Usman My LinkedIn <http://www.linkedin.com/pub/mufeed-usman/28/254/400> | My Social Cause <http://www.vision2016.org.in/> | My Blogs : LiveJournal <http://mufeed.livejournal.com> On Wed, Oct 8, 2014 at 1:51 PM, Steven Phillips <[email protected]> wrote: > I think it needs to be of this form: > > ./sqlline -u "jdbc:drill:zk=<zk quorum>;schema=<schema name>" > > Note that I have semicolon, not colon, separating zk qorum from schema. > > On Wed, Oct 8, 2014 at 12:19 AM, mufy <[email protected]> wrote: > > > Also, the sqlline prompt does not reflect the current schema connected > to: > > > > 0: jdbc:drill:schema=sys:zk=n69:5181,n72:5181> use dfs; > > +------------+------------+ > > | ok | summary | > > +------------+------------+ > > | true | Default schema changed to 'dfs' | > > +------------+------------+ > > 1 row selected (0.052 seconds) > > > > 0: jdbc:drill:schema=sys:zk=n69:5181,n72:5181> > > > > > > [root@n69 bin]# ./sqlline -u jdbc:drill:zk=n69:5181,n72:5181,n73:5181 -n > > admin -p admin > > sqlline version 1.1.6 > > > > 0: jdbc:drill:zk=n69:5181,n72:5181,n73:5181> use sys; > > +------------+------------+ > > | ok | summary | > > +------------+------------+ > > | true | Default schema changed to 'sys' | > > +------------+------------+ > > 1 row selected (0.184 seconds) > > > > 0: jdbc:drill:zk=n69:5181,n72:5181,n73:5181> > > > > > > --- > > Mufeed Usman > > My LinkedIn <http://www.linkedin.com/pub/mufeed-usman/28/254/400> | My > > Social Cause <http://www.vision2016.org.in/> | My Blogs : LiveJournal > > <http://mufeed.livejournal.com> > > > > > > > > > > On Wed, Oct 8, 2014 at 12:06 PM, mufy <[email protected]> wrote: > > > > > *[CONCERN 1]* > > > > > > I can connect in the following 2 ways, > > > > > > METHOD 1 : sqlline -u jdbc:drill:zk=n69:5181,n72:5181,n73:5181 -n admin > > > -p admin (Not specifying schema) > > > METHOD 2 : sqlline -u > jdbc:drill:schema=sys:zk=n69:5181,n72:5181,n73:5181 > > > -n admin -p admin (Specifying schema) > > > > > > Like in SQL, I was under the impression that once directly connected to > > > the schema I'd not have to explicitly specify the schema when querying > > the > > > table. But it did not seem to work. For example, > > > > > > [root@n69 bin]# ./sqlline -u > > > jdbc:drill:schema=sys:zk=n69:5181,n72:5181,n73:5181 -n admin -p admin > > > sqlline version 1.1.6 > > > 0: jdbc:drill:schema=sys:zk=n69:5181,n72:5181> show tables; > > > Query failed: Failure while parsing sql. No schema selected. Select a > > > schema using 'USE schema' command > [d4114b19-095f-409b-bb46-5e940c328c91] > > > > > > Error: exception while executing query: Failure while trying to get > next > > > result batch. (state=,code=0) > > > > > > 0: jdbc:drill:schema=sys:zk=n69:5181,n72:5181> select * from drillbits; > > > Query failed: Failure while parsing sql. Table 'drillbits' not found > > > [d28fa64c-13a4-4b7c-a6ea-8e77f1a3b243] > > > > > > Error: exception while executing query: Failure while trying to get > next > > > result batch. (state=,code=0) > > > > > > > > > But it worked only when I specified `schema`.`table`. Is that the > > expected > > > behavior? > > > > > > 0: jdbc:drill:schema=sys:zk=n69:5181,n72:5181> select * from > > sys.drillbits; > > > +------------+------------+--------------+------------+ > > > | host | user_port | control_port | data_port | > > > +------------+------------+--------------+------------+ > > > | n69 | 31010 | 31011 | 31012 | > > > +------------+------------+--------------+------------+ > > > 1 row selected (0.191 seconds) > > > > > > > > > *[CONCERN 2]* > > > > > > What's the advantage of specifying the ZK ensemble in the sqlline > > > connection string? With the way PStore is handled now (directly on the > > > HDFS), is it relevant anymore? > > > > > > > > > --- > > > Mufeed Usman > > > My LinkedIn <http://www.linkedin.com/pub/mufeed-usman/28/254/400> | My > > > Social Cause <http://www.vision2016.org.in/> | My Blogs : LiveJournal > > > <http://mufeed.livejournal.com> > > > > > > > > > > > > > > > > > > -- > Steven Phillips > Software Engineer > > mapr.com >
