title: how do I list all columns in all tables in all databases in Hive
body: <p><br>
  I need to make a list of all columns in all tables from all databases in my Hive.</p>
  
  <p>I need a row like:<b></p>
  
  <pre><code>Database.table.column column_type comment
  </code></pre>
  
  <p></b></p>
  
  <p>Obviously I can use </p>
  
  <pre><code>show databases;
  </code></pre>
  
  <p>and for each database I can use</p>
  
  <pre><code>show tables;
  </code></pre>
  
  <p>and for each table use:</p>
  
  <pre><code>describe table_name;
  </code></pre>
  
  <p>Obviously I could use Hive_metastore database that is somewhere in my Postgress database, but i have no accesss there.</p>
  
  <p>But I'd like to have one bash script that would loop over databases->tables->columns and get the details.</p>
  
  <p>I have started with generating a list of databases:</p>
  
  <pre><code>hive -e 'show databases;' | tee databases.txt
  </code></pre>
  
  <p>Than I was going to loop over the databases and make a list of tables:</p>
  
  <pre><code>#!/bin/bash
  
  for i in `cat databases.txt`;
  # w i mamy liste baz
    do
     hive -e 'show tables where database = $i;' | tee tables.txt
  
  done
  </code></pre>
  
  <p>But I feel in guts that it's not the right way...
  Can you help?</p>
  
  <p>Regards <br>
  Pawel</p>