Drop Hive external table WITHOUT removing data
<p>The goal is to destroy a Hive schema but keep the data underneath.</p>

<p>Given a Hive external table, created for example with script 1, it can be dropped with script 2. This deletes the data (removes the folder <code>/user/me/data/</code>). This folder has to remain for use in other projects.</p>

<p>A long search does not yield anything so far...</p>

<p><strong>Script 1: Create an external table</strong></p>

<pre><code>CREATE EXTERNAL TABLE external_hive_table(
    column1 STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY
    '\t'
STORED AS TEXTFILE
LOCATION
   '/user/me/data/'
TBLPROPERTIES (
    "skip.header.line.count"="1");
</code></pre>

<p><strong>Script 2: Drop external table (drop data)</strong></p>

<pre><code>ALTER TABLE
    external_hive_table
SET TBLPROPERTIES (
    'EXTERNAL'='FALSE');

DROP TABLE external_hive_table;
</code></pre>

<p><strong>Edit: Script 3: Drop external table (keep data)</strong></p>

<pre><code> DROP TABLE external_hive_table;
</code></pre>