How to create an external hive table from the header of a CSV file
<p>I have a CSV file with header as below.</p>

<p><strong>Column1, Column2, ... Column150</strong></p>

<p>data1,data2,....        data150</p>

<p>I have around 150 columns and to create a hive table I need to give all the column names present in the header and need to skip header using skip.header.line.count=1</p>

<p>Here I am skipping the header and not using it for table creation.</p>

<blockquote>
  <p>create external table EMPLOYEES
  (</p>
  
  <p>column1 STRING,</p>
  
  <p>column2 STRING,....</p>
  
  <p>column150 STRING) </p>
  
  <p>LOCATION 'PATH' </p>
  
  <p>TBLPROPERTIES ("skip.header.line.count"="1")</p>
</blockquote>

<p>Is there anyway that I could create a table from the column names specified in the header with default datatype as STRING?</p>

<p>I know that I could copy the header and populate the create query.<br>But I just wanted to know whether I could specify a property in hive to load the column names from header.</p>

<p>Thanks in advance.</p>