Can we create a view name having multiple '-' or '/' in Hive



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I want to create a view name which is actually a result of stored variable which looks like school/123-324-235. Hive doesnot allows to create such view names. But seriously if I can create such view it would be much helpful. Is there any way to name the view such with any tricks then please help.










share|improve this question






























    1















    I want to create a view name which is actually a result of stored variable which looks like school/123-324-235. Hive doesnot allows to create such view names. But seriously if I can create such view it would be much helpful. Is there any way to name the view such with any tricks then please help.










    share|improve this question


























      1












      1








      1








      I want to create a view name which is actually a result of stored variable which looks like school/123-324-235. Hive doesnot allows to create such view names. But seriously if I can create such view it would be much helpful. Is there any way to name the view such with any tricks then please help.










      share|improve this question
















      I want to create a view name which is actually a result of stored variable which looks like school/123-324-235. Hive doesnot allows to create such view names. But seriously if I can create such view it would be much helpful. Is there any way to name the view such with any tricks then please help.







      hive hiveql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 13:49







      Vijaya Seetharaman

















      asked Nov 15 '18 at 12:12









      Vijaya SeetharamanVijaya Seetharaman

      6419




      6419






















          1 Answer
          1






          active

          oldest

          votes


















          0














          As per HIVE-12381 HIVE-11699 Jira's starting from Hive-2.0 version



          • we can create hive table/view with / in it's name but we are still not able to use - in the table names.

          Ex:



          Connected to: Apache Hive (version 1.2.1000.2.6.4.0-91)



          hive> set hive.support.special.characters.tablename=true;
          hive> create view `school123/245` as select * from <tb_name>;
          hive> select * from `school123/245`;
          hive> drop view `school123/245`;


          Please refer to this link for workaround for this case changing the table name in metastore.






          share|improve this answer























          • sir can we use a result of a query to be the name of the view and do you know how to do it? the result may have '.' in it like prod.school.kolkata

            – Vijaya Seetharaman
            Nov 15 '18 at 16:04











          • @VijayaSeetharaman, if you are using Hive terminal then set hive.cli.print.header=true; this property to print out column names while selecting from the view.

            – Shu
            Nov 15 '18 at 17:44











          • you dint get my point. I want the view name to be used from a result from query. Supoose the query is select school where the id is xyz The result would be HS_School. Can create view with that name? I mean how to frame the create view statement like: create view (select school where the id is xyz) as (Select * from <tablename> join <tablename2>). I want the name coming from a select view.

            – Vijaya Seetharaman
            Nov 16 '18 at 4:48












          • @VijayaSeetharaman, No, it is not possible with Hive, while creating view we need to give view name and we cannot use select query results as view names.

            – Shu
            Nov 19 '18 at 14:58











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319248%2fcan-we-create-a-view-name-having-multiple-or-in-hive%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          As per HIVE-12381 HIVE-11699 Jira's starting from Hive-2.0 version



          • we can create hive table/view with / in it's name but we are still not able to use - in the table names.

          Ex:



          Connected to: Apache Hive (version 1.2.1000.2.6.4.0-91)



          hive> set hive.support.special.characters.tablename=true;
          hive> create view `school123/245` as select * from <tb_name>;
          hive> select * from `school123/245`;
          hive> drop view `school123/245`;


          Please refer to this link for workaround for this case changing the table name in metastore.






          share|improve this answer























          • sir can we use a result of a query to be the name of the view and do you know how to do it? the result may have '.' in it like prod.school.kolkata

            – Vijaya Seetharaman
            Nov 15 '18 at 16:04











          • @VijayaSeetharaman, if you are using Hive terminal then set hive.cli.print.header=true; this property to print out column names while selecting from the view.

            – Shu
            Nov 15 '18 at 17:44











          • you dint get my point. I want the view name to be used from a result from query. Supoose the query is select school where the id is xyz The result would be HS_School. Can create view with that name? I mean how to frame the create view statement like: create view (select school where the id is xyz) as (Select * from <tablename> join <tablename2>). I want the name coming from a select view.

            – Vijaya Seetharaman
            Nov 16 '18 at 4:48












          • @VijayaSeetharaman, No, it is not possible with Hive, while creating view we need to give view name and we cannot use select query results as view names.

            – Shu
            Nov 19 '18 at 14:58















          0














          As per HIVE-12381 HIVE-11699 Jira's starting from Hive-2.0 version



          • we can create hive table/view with / in it's name but we are still not able to use - in the table names.

          Ex:



          Connected to: Apache Hive (version 1.2.1000.2.6.4.0-91)



          hive> set hive.support.special.characters.tablename=true;
          hive> create view `school123/245` as select * from <tb_name>;
          hive> select * from `school123/245`;
          hive> drop view `school123/245`;


          Please refer to this link for workaround for this case changing the table name in metastore.






          share|improve this answer























          • sir can we use a result of a query to be the name of the view and do you know how to do it? the result may have '.' in it like prod.school.kolkata

            – Vijaya Seetharaman
            Nov 15 '18 at 16:04











          • @VijayaSeetharaman, if you are using Hive terminal then set hive.cli.print.header=true; this property to print out column names while selecting from the view.

            – Shu
            Nov 15 '18 at 17:44











          • you dint get my point. I want the view name to be used from a result from query. Supoose the query is select school where the id is xyz The result would be HS_School. Can create view with that name? I mean how to frame the create view statement like: create view (select school where the id is xyz) as (Select * from <tablename> join <tablename2>). I want the name coming from a select view.

            – Vijaya Seetharaman
            Nov 16 '18 at 4:48












          • @VijayaSeetharaman, No, it is not possible with Hive, while creating view we need to give view name and we cannot use select query results as view names.

            – Shu
            Nov 19 '18 at 14:58













          0












          0








          0







          As per HIVE-12381 HIVE-11699 Jira's starting from Hive-2.0 version



          • we can create hive table/view with / in it's name but we are still not able to use - in the table names.

          Ex:



          Connected to: Apache Hive (version 1.2.1000.2.6.4.0-91)



          hive> set hive.support.special.characters.tablename=true;
          hive> create view `school123/245` as select * from <tb_name>;
          hive> select * from `school123/245`;
          hive> drop view `school123/245`;


          Please refer to this link for workaround for this case changing the table name in metastore.






          share|improve this answer













          As per HIVE-12381 HIVE-11699 Jira's starting from Hive-2.0 version



          • we can create hive table/view with / in it's name but we are still not able to use - in the table names.

          Ex:



          Connected to: Apache Hive (version 1.2.1000.2.6.4.0-91)



          hive> set hive.support.special.characters.tablename=true;
          hive> create view `school123/245` as select * from <tb_name>;
          hive> select * from `school123/245`;
          hive> drop view `school123/245`;


          Please refer to this link for workaround for this case changing the table name in metastore.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '18 at 14:23









          ShuShu

          5,3312520




          5,3312520












          • sir can we use a result of a query to be the name of the view and do you know how to do it? the result may have '.' in it like prod.school.kolkata

            – Vijaya Seetharaman
            Nov 15 '18 at 16:04











          • @VijayaSeetharaman, if you are using Hive terminal then set hive.cli.print.header=true; this property to print out column names while selecting from the view.

            – Shu
            Nov 15 '18 at 17:44











          • you dint get my point. I want the view name to be used from a result from query. Supoose the query is select school where the id is xyz The result would be HS_School. Can create view with that name? I mean how to frame the create view statement like: create view (select school where the id is xyz) as (Select * from <tablename> join <tablename2>). I want the name coming from a select view.

            – Vijaya Seetharaman
            Nov 16 '18 at 4:48












          • @VijayaSeetharaman, No, it is not possible with Hive, while creating view we need to give view name and we cannot use select query results as view names.

            – Shu
            Nov 19 '18 at 14:58

















          • sir can we use a result of a query to be the name of the view and do you know how to do it? the result may have '.' in it like prod.school.kolkata

            – Vijaya Seetharaman
            Nov 15 '18 at 16:04











          • @VijayaSeetharaman, if you are using Hive terminal then set hive.cli.print.header=true; this property to print out column names while selecting from the view.

            – Shu
            Nov 15 '18 at 17:44











          • you dint get my point. I want the view name to be used from a result from query. Supoose the query is select school where the id is xyz The result would be HS_School. Can create view with that name? I mean how to frame the create view statement like: create view (select school where the id is xyz) as (Select * from <tablename> join <tablename2>). I want the name coming from a select view.

            – Vijaya Seetharaman
            Nov 16 '18 at 4:48












          • @VijayaSeetharaman, No, it is not possible with Hive, while creating view we need to give view name and we cannot use select query results as view names.

            – Shu
            Nov 19 '18 at 14:58
















          sir can we use a result of a query to be the name of the view and do you know how to do it? the result may have '.' in it like prod.school.kolkata

          – Vijaya Seetharaman
          Nov 15 '18 at 16:04





          sir can we use a result of a query to be the name of the view and do you know how to do it? the result may have '.' in it like prod.school.kolkata

          – Vijaya Seetharaman
          Nov 15 '18 at 16:04













          @VijayaSeetharaman, if you are using Hive terminal then set hive.cli.print.header=true; this property to print out column names while selecting from the view.

          – Shu
          Nov 15 '18 at 17:44





          @VijayaSeetharaman, if you are using Hive terminal then set hive.cli.print.header=true; this property to print out column names while selecting from the view.

          – Shu
          Nov 15 '18 at 17:44













          you dint get my point. I want the view name to be used from a result from query. Supoose the query is select school where the id is xyz The result would be HS_School. Can create view with that name? I mean how to frame the create view statement like: create view (select school where the id is xyz) as (Select * from <tablename> join <tablename2>). I want the name coming from a select view.

          – Vijaya Seetharaman
          Nov 16 '18 at 4:48






          you dint get my point. I want the view name to be used from a result from query. Supoose the query is select school where the id is xyz The result would be HS_School. Can create view with that name? I mean how to frame the create view statement like: create view (select school where the id is xyz) as (Select * from <tablename> join <tablename2>). I want the name coming from a select view.

          – Vijaya Seetharaman
          Nov 16 '18 at 4:48














          @VijayaSeetharaman, No, it is not possible with Hive, while creating view we need to give view name and we cannot use select query results as view names.

          – Shu
          Nov 19 '18 at 14:58





          @VijayaSeetharaman, No, it is not possible with Hive, while creating view we need to give view name and we cannot use select query results as view names.

          – Shu
          Nov 19 '18 at 14:58



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319248%2fcan-we-create-a-view-name-having-multiple-or-in-hive%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo