<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Query to access all managed tables of a given database in Hive Metastore in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Query-to-access-all-managed-tables-of-a-given-database-in/m-p/236843#M198656</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/115696/rohinimathursjc.html" nodeid="115696"&gt;@Rohini Mathur&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Using Shell script:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;one way of doing this would be using Shell script and to get all tables from the database &lt;/P&gt;&lt;PRE&gt;show tables from &amp;lt;db_name&amp;gt;;&lt;/PRE&gt;&lt;P&gt;then store all the tables into a variable and then loop through the each variable and execute&lt;/P&gt;&lt;PRE&gt;show create table &amp;lt;table_name&amp;gt;;&lt;/PRE&gt;&lt;P&gt;command.&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Using Spark:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Another way would be&lt;/P&gt;&lt;P&gt;Using &lt;STRONG&gt;spark.catalog.listtables("&amp;lt;db_name&amp;gt;")&lt;/STRONG&gt; to list out all the tables from database then filter out only the managed tables and execute show create table on the list of managed tables..&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Using Hive metastore db:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hive stores all the table information in metastore like mysql..etc you can also get information about tables from metastore also.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2019 09:53:37 GMT</pubDate>
    <dc:creator>Shu_ashu</dc:creator>
    <dc:date>2019-07-31T09:53:37Z</dc:date>
  </channel>
</rss>

