<?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: Databricks to Oracle to Delete Rows in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-to-oracle-to-delete-rows/m-p/74199#M34734</link>
    <description>&lt;P&gt;Turns out the issue was my command format.&amp;nbsp; After many re-attempts with changes along the way - I finally had success using the format:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;EM&gt;sql_delete &lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;= "DELETE FROM owner.table_name WHERE ROW_ID BETWEEN :value1 AND :value2"&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;value_to_delete1 = variable1&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;value_to_delete2 = variable2&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;with conn.cursor() as cursor:&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; cursor.execute(sql_delete, [value_to_delete1, value_to_delete2])&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; conn.commit()&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; print(f"{cursor.rowcount} rows deleted from EIM_LOY_DIST previous run.")&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 15 Jun 2024 13:26:51 GMT</pubDate>
    <dc:creator>QuikPl4y</dc:creator>
    <dc:date>2024-06-15T13:26:51Z</dc:date>
    <item>
      <title>Databricks to Oracle to Delete Rows</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-to-oracle-to-delete-rows/m-p/73863#M34673</link>
      <description>&lt;P&gt;Hi Community! &amp;nbsp;I’m working in a Fatabricks notebook and using the Oracle JDBC Thin Client connector to query and Oracle table, merge together and select specific rows from my dataframe and write those rows to a table back in Oracle. All of this works well so far, however I need to be able to delete a subset of records from an Oracle table before inserting new ones. I’ve tried using a cursor.execute with a parameterized delete statement, and Databricks appears to successfully run, but no rows are deleted from the target table. Is there an example someone can provide where this does work, as google searches have produced very little to try.&amp;nbsp;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 19:35:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-to-oracle-to-delete-rows/m-p/73863#M34673</guid>
      <dc:creator>QuikPl4y</dc:creator>
      <dc:date>2024-06-13T19:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks to Oracle to Delete Rows</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-to-oracle-to-delete-rows/m-p/74105#M34728</link>
      <description>&lt;P&gt;This stack overflow post ran into the same issue, would be worth trying&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/76199530/how-to-delete-a-record-from-oracle-table-in-python-sqlalchemy" target="_blank"&gt;How to delete a record from Oracle Table in Python SQLAlchemy - Stack Overflow&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2024 04:45:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-to-oracle-to-delete-rows/m-p/74105#M34728</guid>
      <dc:creator>delonb2</dc:creator>
      <dc:date>2024-06-15T04:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks to Oracle to Delete Rows</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-to-oracle-to-delete-rows/m-p/74199#M34734</link>
      <description>&lt;P&gt;Turns out the issue was my command format.&amp;nbsp; After many re-attempts with changes along the way - I finally had success using the format:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;EM&gt;sql_delete &lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;= "DELETE FROM owner.table_name WHERE ROW_ID BETWEEN :value1 AND :value2"&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;value_to_delete1 = variable1&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;value_to_delete2 = variable2&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;with conn.cursor() as cursor:&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; cursor.execute(sql_delete, [value_to_delete1, value_to_delete2])&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; conn.commit()&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; print(f"{cursor.rowcount} rows deleted from EIM_LOY_DIST previous run.")&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2024 13:26:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-to-oracle-to-delete-rows/m-p/74199#M34734</guid>
      <dc:creator>QuikPl4y</dc:creator>
      <dc:date>2024-06-15T13:26:51Z</dc:date>
    </item>
  </channel>
</rss>

