<?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 Initializing Session Variables for use in row filtering/column masking in Every Session in Data Governance</title>
    <link>https://community.databricks.com/t5/data-governance/initializing-session-variables-for-use-in-row-filtering-column/m-p/72457#M1865</link>
    <description>&lt;P&gt;I just got through reading the great technical blog post from&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/82608"&gt;@SergeRielau&lt;/a&gt;&amp;nbsp; about session variables&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.databricks.com/t5/technical-blog/sql-session-variables-stash-your-state-and-use-it-too/bc-p/72453#M193" target="_blank"&gt;https://community.databricks.com/t5/technical-blog/sql-session-variables-stash-your-state-and-use-it-too/bc-p/72453#M193&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Super useful facility and well explained, thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my question, though:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a need for a session variable (containing a Map) to be initialized in every session based on the results of a database query. It will be used in row filtering and column masking functions in Unity Catalog, so it's necessary that there's basically no way ever to sidestep this initialization for reasons of needing to protect sensitive data.&lt;/P&gt;&lt;P&gt;Where is the best place to put that initialization code to set such session variables at the very beginning of every session?&lt;/P&gt;&lt;P&gt;My first thought had been to do a kind of lazy call to initialize the variables in the row filtering/column masking functions but that's not feasible since SQL UDFs we're using for those can't have side effects such as setting session variables.&lt;/P&gt;&lt;P&gt;I'm in the dark on how to get this done.&amp;nbsp; Any suggestions appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2024 20:36:36 GMT</pubDate>
    <dc:creator>AntonioR</dc:creator>
    <dc:date>2024-06-11T20:36:36Z</dc:date>
    <item>
      <title>Initializing Session Variables for use in row filtering/column masking in Every Session</title>
      <link>https://community.databricks.com/t5/data-governance/initializing-session-variables-for-use-in-row-filtering-column/m-p/72457#M1865</link>
      <description>&lt;P&gt;I just got through reading the great technical blog post from&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/82608"&gt;@SergeRielau&lt;/a&gt;&amp;nbsp; about session variables&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.databricks.com/t5/technical-blog/sql-session-variables-stash-your-state-and-use-it-too/bc-p/72453#M193" target="_blank"&gt;https://community.databricks.com/t5/technical-blog/sql-session-variables-stash-your-state-and-use-it-too/bc-p/72453#M193&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Super useful facility and well explained, thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my question, though:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a need for a session variable (containing a Map) to be initialized in every session based on the results of a database query. It will be used in row filtering and column masking functions in Unity Catalog, so it's necessary that there's basically no way ever to sidestep this initialization for reasons of needing to protect sensitive data.&lt;/P&gt;&lt;P&gt;Where is the best place to put that initialization code to set such session variables at the very beginning of every session?&lt;/P&gt;&lt;P&gt;My first thought had been to do a kind of lazy call to initialize the variables in the row filtering/column masking functions but that's not feasible since SQL UDFs we're using for those can't have side effects such as setting session variables.&lt;/P&gt;&lt;P&gt;I'm in the dark on how to get this done.&amp;nbsp; Any suggestions appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 20:36:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/initializing-session-variables-for-use-in-row-filtering-column/m-p/72457#M1865</guid>
      <dc:creator>AntonioR</dc:creator>
      <dc:date>2024-06-11T20:36:36Z</dc:date>
    </item>
  </channel>
</rss>

