You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by dsaivarunvishal reddy <sa...@gmail.com> on 2018/08/11 06:34:59 UTC

Ability to set/change default schema for all sessions.

USE schema; would change the default schema for the current session, it
would be useful if we can have ability to change the default schema to look
into through out all sessions.

Re: Ability to set/change default schema for all sessions.

Posted by Abhishek Girish <ag...@apache.org>.
Not entirely sure of what you are asking for, but here is a suggestion -
when you connect through sqlline, you have the ability to set the session
schema as follows [1]:

$DRILL_HOME/bin/sqlline -u "jdbc:drill:zk=localhost:2181;schema=dfs.tmp" -n
user1


This was, each new sqlline session you start, automatically uses the
dfs.tmp schema.workspace. Let us know if it helps, or if you have any
questions

[1]
https://drill.apache.org/docs/starting-drill-in-distributed-mode/#using-an-ad-hoc-connection-to-drill

On Sat, Aug 11, 2018 at 12:31 AM dsaivarunvishal reddy <
saivarunvishal@gmail.com> wrote:

> USE schema; would change the default schema for the current session, it
> would be useful if we can have ability to change the default schema to look
> into through out all sessions.
>

Re: Ability to set/change default schema for all sessions.

Posted by Paul Rogers <pa...@yahoo.com.INVALID>.
Hi,
Sounds like you are asking to have the default schema be an attribute of the user. Each time I log in, I get the "customer" schema, while each time you log in, you get the "sales" schema. Correct?

At present, Drill has no concept of a user as an entity. Drill can perform user authentication using an external system. But, unlike, say, Oracle or MySql, Drill maintains no per-user properties.

Could such a feature be added? Certainly. Perhaps the data could be stored as a LDAP attribute. Perhaps Drill could keep this information in ZooKeeper. Or, once Drill has a metastore, user attributes could be stored there as well.

Or, are you asking that a particular schema be the default for everyone in all sessions? That is, when either you or I log in, we are both presented with the "customer" schema as the default. Again, this is not possible today, but a global setting fits within Drill's existing code: just enhance the session initiation code to consult a new System option for the global default schema.


I would recommend filing a JIRA enhancement to track this use case, whichever is the one you want. And, if you need this feature, please consider implementing it and offering it as a pull request.


Note that a related request would be session attributes related to tables (or files or schemas). For example, the "all text mode" for JSON is a session attribute. If I have file a.json that needs this mode, but file b.json that does not, I have to remember to turn "all text mode" on and off as I switch between files. Would be very helpful if the "all text mode" setting was an attribute of the file, and if Drill would then enable/disable it automatically when I query that file.

Again, today there is no good place to store that information (other than in the script running queries or in the user's head.) Again, once Drill has a metastore of some kind, session options could become a property of a table/file/schema.

Thanks,
- Paul

 

    On Saturday, August 11, 2018, 12:31:11 AM PDT, dsaivarunvishal reddy <sa...@gmail.com> wrote:  
 
 USE schema; would change the default schema for the current session, it
would be useful if we can have ability to change the default schema to look
into through out all sessions.