<?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>topic Re: How to get all the tables name with a specific column or columns in a database? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26803#M18814</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;databaseName = "db"
desiredColumn = "project_id"
database = spark.sql(f"show tables in {databaseName} ").collect()
tablenames = []
for row in database:
  cols = spark.table(row.tableName).columns
  if desiredColumn in cols:
    tablenames.append(row.tableName)
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Something close to that should work.  &lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 11:53:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-10-18T11:53:00Z</dc:date>
    <item>
      <title>How to get all the tables name with a specific column or columns in a database?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26802#M18813</link>
      <description>&lt;P&gt;let's say there is a database db in which 700 tables are there, and we need to find all the tables name in which column "project_id" is present.&lt;/P&gt;&lt;P&gt;just an example for ubderstanding the questions.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 11:08:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26802#M18813</guid>
      <dc:creator>ramankr48</dc:creator>
      <dc:date>2022-10-18T11:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all the tables name with a specific column or columns in a database?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26803#M18814</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;databaseName = "db"
desiredColumn = "project_id"
database = spark.sql(f"show tables in {databaseName} ").collect()
tablenames = []
for row in database:
  cols = spark.table(row.tableName).columns
  if desiredColumn in cols:
    tablenames.append(row.tableName)
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Something close to that should work.  &lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 11:53:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26803#M18814</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-18T11:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all the tables name with a specific column or columns in a database?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26804#M18815</link>
      <description>&lt;P&gt;Thanks josephk it worked&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 11:58:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26804#M18815</guid>
      <dc:creator>ramankr48</dc:creator>
      <dc:date>2022-10-18T11:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all the tables name with a specific column or columns in a database?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26805#M18816</link>
      <description>&lt;P&gt;Other possible solutions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;use new databricks search,&lt;/LI&gt;&lt;LI&gt;for those who migrated, use lineage in the unity catalog,&lt;/LI&gt;&lt;LI&gt;use lineage with Pureview (there is integration with hive metastore)&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 18 Oct 2022 18:09:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26805#M18816</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-10-18T18:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all the tables name with a specific column or columns in a database?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26806#M18817</link>
      <description>&lt;P&gt;Thanks @Joseph Kambourakis​&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the code seems to rendering errors at my end: &lt;/P&gt;&lt;P&gt;com.immuta.spark.exceptions.NoSuchDataSourceException: A data source with the table name &amp;amp;#39;`v_table_name`&amp;amp;#39; does not exist, is not in the current project, or is not accessible by the current user.&lt;/P&gt;&lt;P&gt;I've changed the original table name to 'v_table_name', as it happenes the table name is the first table on the schema, so it seems the code is searching through the schema but fails on the first table for some reason. Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 17:43:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26806#M18817</guid>
      <dc:creator>Being-UK</dc:creator>
      <dc:date>2023-02-27T17:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all the tables name with a specific column or columns in a database?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26807#M18818</link>
      <description>&lt;P&gt;Sounds like an immuta problem, ask them.  Def not a spark error. &lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 18:04:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-all-the-tables-name-with-a-specific-column-or-columns/m-p/26807#M18818</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-14T18:04:40Z</dc:date>
    </item>
  </channel>
</rss>

