

{"id":19879,"date":"2018-06-22T15:36:38","date_gmt":"2018-06-22T15:36:38","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=19879"},"modified":"2018-06-22T15:36:38","modified_gmt":"2018-06-22T15:36:38","slug":"hcatalog-command-line-interface","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/","title":{"rendered":"Learn HCatalog Command Line Interface(CLI)"},"content":{"rendered":"<p><span style=\"font-weight: 400\">In this <strong>HCatalog tutorial<\/strong>, we will learn the concept of HCatalog Command Line Interface. Moreover, in this HCatalog CLI, we will see command line options in HCatalog and DDL Commands and description. <\/span><\/p>\n<p><span style=\"font-weight: 400\">So, let\u2019s start HCatalog Command Line Interface.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">What is HCatalog Command Line Interface?<\/span><\/h2>\n<p><span style=\"font-weight: 400\">By using command <strong>$HIVE_HOME\/HCatalog\/bin\/<\/strong>hcat, we can invoke HCatalog Command Line Interface (CLI) where <strong>$HIVE_HOME<\/strong> is the home directory of <strong>Hive<\/strong>. Basically, to initialize the HCatalog server hcat\u00a0is the right command.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Command to initialize HCatalog command line<\/strong><\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\">cd $HCAT_HOME\/bin\n.\/hcat<\/pre>\n<ul>\n<li style=\"font-weight: 400\"><strong>Output<\/strong><\/li>\n<\/ul>\n<p><b>SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]<\/b><br \/>\n<b>usage: hcat { -e &#8220;&lt;query&gt;&#8221; | -f &#8220;&lt;filepath&gt;&#8221; } <\/b><br \/>\n<b> \u00a0\u00a0[ -g &#8220;&lt;group&gt;&#8221; ] [ -p &#8220;&lt;perms&gt;&#8221; ] <\/b><br \/>\n<b> \u00a0\u00a0[ -D&#8221;&lt;name&gt; = &lt;value&gt;&#8221; ]<\/b><br \/>\n<b>-D &lt;property = value&gt; \u00a0\u00a0\u00a0use hadoop value for given property<\/b><br \/>\n<b>-e &lt;exec&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0hcat command given from command line<\/b><br \/>\n<b>-f &lt;file&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0hcat commands in file<\/b><br \/>\n<b>-g &lt;group&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0group for the db\/table specified in CREATE statement<\/b><br \/>\n<b>-h,&#8211;help \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Print help information<\/b><br \/>\n<b>-p &lt;perms&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0permissions for the db\/table specified in CREATE statement<\/b><\/p>\n<h2><span style=\"font-weight: 400\">Command Line Options in HCatalog<\/span><\/h2>\n<p><span style=\"font-weight: 400\">There are several commands supported by HCatalog CLI \u2212<\/span><\/p>\n<h4>a. -g<\/h4>\n<p><span style=\"font-weight: 400\">Usage- hcat -g mygroup &#8230;<\/span><br \/>\n<span style=\"font-weight: 400\">The table which we need to create must have the group &#8220;mygroup&#8221;.<\/span><\/p>\n<h4>b. -p<\/h4>\n<p><span style=\"font-weight: 400\">Usage-hcat -p rwxr-xr-x &#8230;<\/span><br \/>\n<span style=\"font-weight: 400\">Also, the table which we need to create must have read, write, as well as execute permissions.<\/span><\/p>\n<h4>c. -f<\/h4>\n<p><span style=\"font-weight: 400\">Usage- hcat -f myscript.HCatalog &#8230;<\/span><br \/>\n<span style=\"font-weight: 400\">In order to execute, myscript.HCatalog is a script file containing DDL commands.<\/span><\/p>\n<h4>d. -e<\/h4>\n<p><span style=\"font-weight: 400\">Usage- hcat -e &#8216;create table mytable(a int);&#8217; &#8230;<\/span><br \/>\n<span style=\"font-weight: 400\">At first,\u00a0consider the following string as a DDL command\u00a0afterward you can execute it.<\/span><\/p>\n<h4>e. -D<\/h4>\n<p><span style=\"font-weight: 400\">Usage- hcat -Dkey = value &#8230;<\/span><br \/>\n<span style=\"font-weight: 400\">The command &#8220;-D&#8221;\u00a0 helps to pass the key-value pair\u00a0as a Java system property to HCatalog.<\/span><\/p>\n<h4>f. hcat<\/h4>\n<p><span style=\"font-weight: 400\">This command helps to print a usage message.<\/span><br \/>\n<strong>Note \u2212<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Both the -g and -p options are not mandatory.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Either -e or -f option can be provided, at one time, not both.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">We can specify the options in any order, basically, the order of options is immaterial.<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400\">DDL Command &amp; Description<\/span><\/h2>\n<p>Below, weare discussing HCatalog DDL Commands with their description:<\/p>\n<div id=\"attachment_20172\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/DDL-Command-and-Description-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-20172\" class=\"wp-image-20172 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/DDL-Command-and-Description-01.jpg\" alt=\"HCatalog Command Line Interface\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/DDL-Command-and-Description-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/DDL-Command-and-Description-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/DDL-Command-and-Description-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/DDL-Command-and-Description-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/DDL-Command-and-Description-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-20172\" class=\"wp-caption-text\">HCatalog Command Line Interface &#8211; DDL Commands<\/p><\/div>\n<h3><span style=\"font-weight: 400\">a. CREATE TABLE<\/span><\/h3>\n<p><span style=\"font-weight: 400\">As par name, it creates a table using HCatalog.\u00a0<\/span><\/p>\n<h3><span style=\"font-weight: 400\">b. ALTER TABLE<\/span><\/h3>\n<p><span style=\"font-weight: 400\">This command is supportable except for the REBUILD and CONCATENATE options.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">c. DROP TABLE<\/span><\/h3>\n<p><span style=\"font-weight: 400\">This command is also supported<\/span><\/p>\n<h3><span style=\"font-weight: 400\">d. CREATE\/ALTER\/DROP VIEW<\/span><\/h3>\n<p><span style=\"font-weight: 400\">It is Supported as well as its behavior is as same as Hive.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">e. SHOW TABLES<\/span><\/h3>\n<p><span style=\"font-weight: 400\">This command displays a list of tables.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">f. SHOW PARTITIONS<\/span><\/h3>\n<p><span style=\"font-weight: 400\">It displays a list of partitions.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">g. Create\/Drop Index<\/span><\/h3>\n<p>Both CREATE as well as DROP FUNCTION operations are supported.<\/p>\n<h3><span style=\"font-weight: 400\">h. DESCRIBE<\/span><\/h3>\n<p>This command describes the structure.<br \/>\nSo, this was all in HCatalog Command Line Interface. Hope you like our explanation.<\/p>\n<h2>Conclusion<\/h2>\n<p>Hence, we have seen the HCatalog CLI and its command. Moreover, in this Hcatalog Command Line Interface, we discussed command line options and DDL commands in detail. In the next blog, we will learn all these <strong>HCatalog commands<\/strong> in detail. So, keep visiting DataFlair for more blogs on HCatalog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this HCatalog tutorial, we will learn the concept of HCatalog Command Line Interface. Moreover, in this HCatalog CLI, we will see command line options in HCatalog and DDL Commands and description. So, let\u2019s&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":20174,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[433,3089,3108,3109,3584,3772,4074,5535,12852,12855],"class_list":["post-19879","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hcatalog","tag-alter-table","tag-create-table","tag-createalterdrop-view","tag-createdrop-index","tag-ddl-commands-in-hcatalog","tag-describe","tag-drop-table","tag-hcatalog-tutorial","tag-show-partitions","tag-show-tables"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Learn HCatalog Command Line Interface(CLI) - DataFlair<\/title>\n<meta name=\"description\" content=\"HCatalog Command Line Interface, HCatalog CLI, DDL Commands in HCatalog, HCatalog Command line options, HCatalog tutorial\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn HCatalog Command Line Interface(CLI) - DataFlair\" \/>\n<meta property=\"og:description\" content=\"HCatalog Command Line Interface, HCatalog CLI, DDL Commands in HCatalog, HCatalog Command line options, HCatalog tutorial\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-06-22T15:36:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/HCatalog-Command-Line-Interface-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Learn HCatalog Command Line Interface(CLI) - DataFlair","description":"HCatalog Command Line Interface, HCatalog CLI, DDL Commands in HCatalog, HCatalog Command line options, HCatalog tutorial","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/","og_locale":"en_US","og_type":"article","og_title":"Learn HCatalog Command Line Interface(CLI) - DataFlair","og_description":"HCatalog Command Line Interface, HCatalog CLI, DDL Commands in HCatalog, HCatalog Command line options, HCatalog tutorial","og_url":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-06-22T15:36:38+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/HCatalog-Command-Line-Interface-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Learn HCatalog Command Line Interface(CLI)","datePublished":"2018-06-22T15:36:38+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/"},"wordCount":544,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/HCatalog-Command-Line-Interface-01.jpg","keywords":["Alter Table","Create Table","CREATE\/ALTER\/DROP VIEW","Create\/Drop Index","DDL Commands in hCatalog","DESCRIBE","Drop Table","HCatalog Tutorial","SHOW PARTITIONS","SHOW TABLES"],"articleSection":["HCatalog Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/","url":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/","name":"Learn HCatalog Command Line Interface(CLI) - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/HCatalog-Command-Line-Interface-01.jpg","datePublished":"2018-06-22T15:36:38+00:00","description":"HCatalog Command Line Interface, HCatalog CLI, DDL Commands in HCatalog, HCatalog Command line options, HCatalog tutorial","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/HCatalog-Command-Line-Interface-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/HCatalog-Command-Line-Interface-01.jpg","width":1200,"height":628,"caption":"Learn HCatalog Command Line Interface(CLI)"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/hcatalog-command-line-interface\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Salesforce Connect example","item":"https:\/\/data-flair.training\/blogs\/tag\/salesforce-connect-example\/"},{"@type":"ListItem","position":3,"name":"Learn HCatalog Command Line Interface(CLI)"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/19879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=19879"}],"version-history":[{"count":0,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/19879\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/20174"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=19879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=19879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=19879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}