<?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: PII tags in Spark Declarative Pipelines in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/pii-tags-in-spark-declarative-pipelines/m-p/156367#M54410</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/227625"&gt;@bi_123&lt;/a&gt;&amp;nbsp; !&lt;/P&gt;&lt;P&gt;You need to use UC&amp;nbsp;tags outside the SPD definition&amp;nbsp;not inside the SDP python function.&lt;/P&gt;&lt;P&gt;@dp.table(table_properties=...) can set table properties&amp;nbsp;but those are not the same as UC&amp;nbsp;tags and&amp;nbsp;spark.sql("ALTER TABLE ...") inside SDP python is not supported because pipeline code is evaluated as a declarative graph and dataset functions should only define or return dataframes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your&amp;nbsp;streaming table, you can use ALTER STREAMING TABLE&amp;nbsp;not ALTER TABLE:&lt;/P&gt;&lt;PRE&gt;-- table level tag
ALTER STREAMING TABLE catalog.schema.my_streaming_table
SET TAGS ('pii' = 'true');

-- column level tags
ALTER STREAMING TABLE catalog.schema.my_streaming_table
ALTER COLUMN email SET TAGS ('pii' = 'email');

ALTER STREAMING TABLE catalog.schema.my_streaming_table
ALTER COLUMN ssn SET TAGS ('pii' = 'ssn');&lt;/PRE&gt;&lt;P&gt;and run this from a DBKS sql env&amp;nbsp;or as a post deployment CI/CD step after the pipeline creates or refreshes the table.&lt;/P&gt;</description>
    <pubDate>Thu, 07 May 2026 09:18:41 GMT</pubDate>
    <dc:creator>amirabedhiafi</dc:creator>
    <dc:date>2026-05-07T09:18:41Z</dc:date>
    <item>
      <title>PII tags in Spark Declarative Pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/pii-tags-in-spark-declarative-pipelines/m-p/156358#M54405</link>
      <description>&lt;P&gt;I need to add PII tags at both the table and column levels for a streaming table created using Spark Declarative Pipelines.&lt;/P&gt;&lt;P&gt;I tried applying Unity Catalog tags with the following code inside the SDP Python pipeline:&lt;/P&gt;&lt;P&gt;spark.sql(f"""&lt;BR /&gt;ALTER TABLE {table_name}&lt;BR /&gt;SET TAGS ({tags_sql})&lt;BR /&gt;""")&lt;/P&gt;&lt;P&gt;However, this fails with the following error:&lt;/P&gt;&lt;P&gt;UNSUPPORTED_SPARK_SQL_COMMAND&lt;BR /&gt;'${command}' is not supported in spark.sql("...") API in SDP Python.&lt;BR /&gt;Supported command: ${supportedCommands}.&lt;/P&gt;&lt;P&gt;What is the correct way to define or apply PII tags for tables and columns created by Spark Declarative Pipelines?&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2026 08:08:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pii-tags-in-spark-declarative-pipelines/m-p/156358#M54405</guid>
      <dc:creator>bi_123</dc:creator>
      <dc:date>2026-05-07T08:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: PII tags in Spark Declarative Pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/pii-tags-in-spark-declarative-pipelines/m-p/156367#M54410</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/227625"&gt;@bi_123&lt;/a&gt;&amp;nbsp; !&lt;/P&gt;&lt;P&gt;You need to use UC&amp;nbsp;tags outside the SPD definition&amp;nbsp;not inside the SDP python function.&lt;/P&gt;&lt;P&gt;@dp.table(table_properties=...) can set table properties&amp;nbsp;but those are not the same as UC&amp;nbsp;tags and&amp;nbsp;spark.sql("ALTER TABLE ...") inside SDP python is not supported because pipeline code is evaluated as a declarative graph and dataset functions should only define or return dataframes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your&amp;nbsp;streaming table, you can use ALTER STREAMING TABLE&amp;nbsp;not ALTER TABLE:&lt;/P&gt;&lt;PRE&gt;-- table level tag
ALTER STREAMING TABLE catalog.schema.my_streaming_table
SET TAGS ('pii' = 'true');

-- column level tags
ALTER STREAMING TABLE catalog.schema.my_streaming_table
ALTER COLUMN email SET TAGS ('pii' = 'email');

ALTER STREAMING TABLE catalog.schema.my_streaming_table
ALTER COLUMN ssn SET TAGS ('pii' = 'ssn');&lt;/PRE&gt;&lt;P&gt;and run this from a DBKS sql env&amp;nbsp;or as a post deployment CI/CD step after the pipeline creates or refreshes the table.&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2026 09:18:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pii-tags-in-spark-declarative-pipelines/m-p/156367#M54410</guid>
      <dc:creator>amirabedhiafi</dc:creator>
      <dc:date>2026-05-07T09:18:41Z</dc:date>
    </item>
  </channel>
</rss>

