<?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: IDENTIFIER not working in UPDATE in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78608#M35567</link>
    <description>&lt;P&gt;Doesn't the docs say it is supported? (DML)&lt;/P&gt;&lt;P&gt;"A column or view referenced in a query. This includes queries embedded in a DDL or DML statement.&lt;BR /&gt;When using the identifier clause it may not be embedded within an identifier."&lt;/P&gt;&lt;P&gt;Here I'm referencing a column in an UPDATE statement.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;spark.sql("""
    UPDATE
        temp
    SET
        IDENTIFIER(:col) = "C"
""",
    args={
        "col": "_1"
    }
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jul 2024 20:10:52 GMT</pubDate>
    <dc:creator>marcuskw</dc:creator>
    <dc:date>2024-07-12T20:10:52Z</dc:date>
    <item>
      <title>IDENTIFIER not working in UPDATE</title>
      <link>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78102#M35465</link>
      <description>&lt;P&gt;The following code works perfectly fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;df = spark.createDataFrame([('A', 1), ('B', 2)])
df.createOrReplaceTempView('temp')

spark.sql("""
    SELECT
        IDENTIFIER(:col)
    FROM
        temp
""",
    args={
        "col": "_1"
    }
).display()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However if we instead want to do an UPDATE the same logic no longer functions:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;spark.sql("""
    UPDATE
        temp
    SET
        IDENTIFIER(:col) = "C"
""",
    args={
        "col": "_1"
    }
)&lt;/LI-CODE&gt;&lt;P&gt;Here we get the following error:&lt;BR /&gt;[PARSE_SYNTAX_ERROR] Syntax error at or near '(': missing EQ. SQLSTATE: 42601&lt;/P&gt;&lt;P&gt;Updating a temp table is not allowed, but used this quickly for a debug example.&lt;BR /&gt;When running the following UPDATE we get the correct error message "&lt;SPAN&gt;UPDATE TABLE is not supported temporarily."&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;spark.sql("""
    UPDATE
        temp
    SET
        _1 = "C"
""")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 11:50:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78102#M35465</guid>
      <dc:creator>marcuskw</dc:creator>
      <dc:date>2024-07-10T11:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: IDENTIFIER not working in UPDATE</title>
      <link>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78520#M35549</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I wrote it in the bottom of my post that I know that updating a Temp table isn't allowed.&lt;BR /&gt;I used it as a quick example to illustrate the error message, but you get the same error message when updating a Delta Lake table.&lt;/P&gt;&lt;P&gt;The problem is the IDENTIFIER() syntax doesn't seem to function properly in an UPDATE statement. But works perfectly fine in a SELECT.&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;Updating a temp table is not allowed, but used this quickly for a debug example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When running the following UPDATE we get the correct error message "&lt;/SPAN&gt;&lt;SPAN&gt;UPDATE TABLE is not supported temporarily.""&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 12:13:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78520#M35549</guid>
      <dc:creator>marcuskw</dc:creator>
      <dc:date>2024-07-12T12:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: IDENTIFIER not working in UPDATE</title>
      <link>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78554#M35555</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/88429"&gt;@marcuskw&lt;/a&gt;&amp;nbsp;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-names-identifier-clause.html" target="_self"&gt;the docs&lt;/A&gt; state that this is actually not supported. You can only use table names in an update statement:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P&gt;Table name of a MERGE, UPDATE, DELETE, INSERT, COPY INTO&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 14:57:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78554#M35555</guid>
      <dc:creator>Witold</dc:creator>
      <dc:date>2024-07-12T14:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: IDENTIFIER not working in UPDATE</title>
      <link>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78608#M35567</link>
      <description>&lt;P&gt;Doesn't the docs say it is supported? (DML)&lt;/P&gt;&lt;P&gt;"A column or view referenced in a query. This includes queries embedded in a DDL or DML statement.&lt;BR /&gt;When using the identifier clause it may not be embedded within an identifier."&lt;/P&gt;&lt;P&gt;Here I'm referencing a column in an UPDATE statement.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;spark.sql("""
    UPDATE
        temp
    SET
        IDENTIFIER(:col) = "C"
""",
    args={
        "col": "_1"
    }
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 20:10:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/78608#M35567</guid>
      <dc:creator>marcuskw</dc:creator>
      <dc:date>2024-07-12T20:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: IDENTIFIER not working in UPDATE</title>
      <link>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/79816#M35856</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/88429"&gt;@marcuskw&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;Sorry for the late response. IMHO the docs are not clear on that, but IDENTIFIER's are not supported in `SET` clauses. It works in `WHERE` clauses though (which of course will not help in your case):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;spark.sql("""
    UPDATE
        temp
    SET
        _1 = "C"
    WHERE
        IDENTIFIER(:col) &amp;lt;&amp;gt; "C"
""",
    args={
        "col": "_1"
    }
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;&amp;nbsp;You should update the docs accordingly.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 07:50:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/79816#M35856</guid>
      <dc:creator>Witold</dc:creator>
      <dc:date>2024-07-22T07:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: IDENTIFIER not working in UPDATE</title>
      <link>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/83181#M36864</link>
      <description>&lt;P&gt;If it helps anyone else I found this article that described a few limitations:&lt;BR /&gt;&lt;A href="https://community.databricks.com/t5/technical-blog/how-not-to-build-an-execute-immediate-demo/ba-p/82167" target="_blank"&gt;https://community.databricks.com/t5/technical-blog/how-not-to-build-an-execute-immediate-demo/ba-p/82167&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marcuskw_0-1723790886149.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10380i1CE2E6E1349054AC/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="marcuskw_0-1723790886149.png" alt="marcuskw_0-1723790886149.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 06:55:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/identifier-not-working-in-update/m-p/83181#M36864</guid>
      <dc:creator>marcuskw</dc:creator>
      <dc:date>2024-08-16T06:55:32Z</dc:date>
    </item>
  </channel>
</rss>

