<?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: Renamed table cannot be written to or deleted from in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33351#M24359</link>
    <description>&lt;P&gt;I tried your code in 11.1 (includes Apache Spark 3.3.0, Scala 2.12) and it worked perfectly fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However it will work perfectly only the first time because if you try to rerun the same code, it'll error out stating renamed_table_name exists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S: Please use code snippet(&amp;lt;/&amp;gt; button) to include your code in your question&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2022 13:16:26 GMT</pubDate>
    <dc:creator>AmanSehgal</dc:creator>
    <dc:date>2022-08-31T13:16:26Z</dc:date>
    <item>
      <title>Renamed table cannot be written to or deleted from</title>
      <link>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33350#M24358</link>
      <description>&lt;P&gt;I have renamed a table, however on trying to write to it (or delete from it) I get the following error: &lt;/P&gt;&lt;P&gt;`java.io.FileNotFoundException: No such file or directory: s3a://.../hive/warehouse/testing.db/renamed_table_name/_delta_log/00000000000000000002.json`&lt;/P&gt;&lt;P&gt;My cluster version is 10.4 LTS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following python snippet can be used to recreate the issue:&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;DB_NAME = 'testing'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def rename(old_table_name, new_table_name):&lt;/P&gt;&lt;P&gt;    spark.conf.set("spark.databricks.delta.alterTable.rename.enabledOnAWS", "true")&lt;/P&gt;&lt;P&gt;    spark.sql(f"ALTER TABLE {DB_NAME}.{old_table_name} RENAME TO {DB_NAME}.{new_table_name}")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def overwrite(table_name, source_df):&lt;/P&gt;&lt;P&gt;    (source_df.write&lt;/P&gt;&lt;P&gt;         .mode("overwrite")&lt;/P&gt;&lt;P&gt;         .format("delta")&lt;/P&gt;&lt;P&gt;         .saveAsTable(f"{DB_NAME}.{table_name}")&lt;/P&gt;&lt;P&gt;    )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def get_df():&lt;/P&gt;&lt;P&gt;    data = [&lt;/P&gt;&lt;P&gt;        ("Name1", "Surname1", 12345),&lt;/P&gt;&lt;P&gt;        ("Name2", "Surname2", 67890),&lt;/P&gt;&lt;P&gt;    ]&lt;/P&gt;&lt;P&gt;    return spark.createDataFrame(data) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sparkDf = get_df()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Create table&lt;/P&gt;&lt;P&gt;overwrite('table_name', sparkDf)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Rename table&lt;/P&gt;&lt;P&gt;rename('table_name', 'renamed_table_name')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Try to write to renamed table (or delete from). Failure happens here&lt;/P&gt;&lt;P&gt;overwrite('renamed_table_name', sparkDf)&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 15:32:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33350#M24358</guid>
      <dc:creator>477061</dc:creator>
      <dc:date>2022-08-26T15:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Renamed table cannot be written to or deleted from</title>
      <link>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33351#M24359</link>
      <description>&lt;P&gt;I tried your code in 11.1 (includes Apache Spark 3.3.0, Scala 2.12) and it worked perfectly fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However it will work perfectly only the first time because if you try to rerun the same code, it'll error out stating renamed_table_name exists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S: Please use code snippet(&amp;lt;/&amp;gt; button) to include your code in your question&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 13:16:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33351#M24359</guid>
      <dc:creator>AmanSehgal</dc:creator>
      <dc:date>2022-08-31T13:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Renamed table cannot be written to or deleted from</title>
      <link>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33352#M24360</link>
      <description>&lt;P&gt;Hi @julie.holtzhausen​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We'd love to hear from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 10:36:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33352#M24360</guid>
      <dc:creator>Vidula</dc:creator>
      <dc:date>2022-09-15T10:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Renamed table cannot be written to or deleted from</title>
      <link>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33353#M24361</link>
      <description>&lt;P&gt;Hi @477061 Could you please try to test it in DBR 11.1 and see if the issue persists for you?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 11:19:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/renamed-table-cannot-be-written-to-or-deleted-from/m-p/33353#M24361</guid>
      <dc:creator>Noopur_Nigam</dc:creator>
      <dc:date>2022-09-30T11:19:53Z</dc:date>
    </item>
  </channel>
</rss>

