<?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 delete duplicate tables? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-delete-duplicate-tables/m-p/12733#M7498</link>
    <description>&lt;P&gt;Hi @Mahesh Babu Uppala​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the below command to delete the particular file&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;dbutils.fs.rm("path of the file")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you want to delete the entire directory where it consists of sub-directories and files, you can use the below command to delete the files recursively&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;dbutils.fs.rm("path of the folder",True)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After executing the above commands you will be getting the output below, to confirm file/directory got deleted successfully.&lt;/P&gt;&lt;P&gt;&lt;B&gt;"Boolean = true&lt;/B&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy Learning!!&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jan 2023 05:25:39 GMT</pubDate>
    <dc:creator>Chaitanya_Raju</dc:creator>
    <dc:date>2023-01-11T05:25:39Z</dc:date>
    <item>
      <title>How to delete duplicate tables?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-delete-duplicate-tables/m-p/12732#M7497</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Accidently imported duplicate tables, guide me how to delete them&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using data bricks community edition &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/865iD1FE102FD31374A5/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 01:08:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-delete-duplicate-tables/m-p/12732#M7497</guid>
      <dc:creator>Mahesh777k</dc:creator>
      <dc:date>2023-01-11T01:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete duplicate tables?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-delete-duplicate-tables/m-p/12733#M7498</link>
      <description>&lt;P&gt;Hi @Mahesh Babu Uppala​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the below command to delete the particular file&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;dbutils.fs.rm("path of the file")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you want to delete the entire directory where it consists of sub-directories and files, you can use the below command to delete the files recursively&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;dbutils.fs.rm("path of the folder",True)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After executing the above commands you will be getting the output below, to confirm file/directory got deleted successfully.&lt;/P&gt;&lt;P&gt;&lt;B&gt;"Boolean = true&lt;/B&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy Learning!!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 05:25:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-delete-duplicate-tables/m-p/12733#M7498</guid>
      <dc:creator>Chaitanya_Raju</dc:creator>
      <dc:date>2023-01-11T05:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete duplicate tables?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-delete-duplicate-tables/m-p/12734#M7499</link>
      <description>&lt;P&gt;Hi @Mahesh Babu Uppala​&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use the following method to delete only the duplicate tables&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%scala
val tables = spark.sql("""SHOW TABLES""").createOrReplaceTempView("tables")
val temp_tables = spark.sql("""select tableName from tables where tableName like '%-1%' """)
temp_tables.collect().foreach(row =&amp;gt; println("DROP TABLE IF EXISTS " + row.toString().replace("[", "").replace("]", "") + ";"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You will get the sql command in a string...you can either copy this cell output to another cell directly and run it or you can automate the process by storing this output into a variable and then calling it through a loop...Better way would be to simply copy the output and execute it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps..Cheers...&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 14:30:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-delete-duplicate-tables/m-p/12734#M7499</guid>
      <dc:creator>UmaMahesh1</dc:creator>
      <dc:date>2023-01-11T14:30:06Z</dc:date>
    </item>
  </channel>
</rss>

