<?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 How to use variable-library values in a notebook in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4671195#M8901</link>
    <description>&lt;P&gt;Within a notebook I would like to retrieve an active variable value from a variable-libary.&amp;nbsp; It is clear how to update the parameter from a Data Pipeline (as depicted below),&amp;nbsp;but I cannot find a python package and method to do this independently in the notebook.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;No problem updating parameter from a Data Pipeline&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhilPrentiss_2-1745848025868.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1263894i20CCDD009DB28E7D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhilPrentiss_2-1745848025868.png" alt="PhilPrentiss_2-1745848025868.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhilPrentiss_1-1745847819235.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1263893i2C9254493F1FB49E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhilPrentiss_1-1745847819235.png" alt="PhilPrentiss_1-1745847819235.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;But I would like to do something like this:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhilPrentiss_3-1745848326128.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1263895iE759B94AAD0662AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhilPrentiss_3-1745848326128.png" alt="PhilPrentiss_3-1745848326128.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: I have seen the REST API method and will use that if necesssary&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/fabric/variablelibrary/items/get-variable-library?tabs=HTTP" target="_blank"&gt;Items - Get Variable Library - REST API (VariableLibrary) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Apr 2025 15:00:52 GMT</pubDate>
    <dc:creator>PhilPrentiss</dc:creator>
    <dc:date>2025-04-28T15:00:52Z</dc:date>
    <item>
      <title>How to use variable-library values in a notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4671195#M8901</link>
      <description>&lt;P&gt;Within a notebook I would like to retrieve an active variable value from a variable-libary.&amp;nbsp; It is clear how to update the parameter from a Data Pipeline (as depicted below),&amp;nbsp;but I cannot find a python package and method to do this independently in the notebook.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;No problem updating parameter from a Data Pipeline&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhilPrentiss_2-1745848025868.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1263894i20CCDD009DB28E7D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhilPrentiss_2-1745848025868.png" alt="PhilPrentiss_2-1745848025868.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhilPrentiss_1-1745847819235.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1263893i2C9254493F1FB49E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhilPrentiss_1-1745847819235.png" alt="PhilPrentiss_1-1745847819235.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;But I would like to do something like this:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhilPrentiss_3-1745848326128.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1263895iE759B94AAD0662AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhilPrentiss_3-1745848326128.png" alt="PhilPrentiss_3-1745848326128.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: I have seen the REST API method and will use that if necesssary&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/fabric/variablelibrary/items/get-variable-library?tabs=HTTP" target="_blank"&gt;Items - Get Variable Library - REST API (VariableLibrary) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 15:00:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4671195#M8901</guid>
      <dc:creator>PhilPrentiss</dc:creator>
      <dc:date>2025-04-28T15:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable-library values in a notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4671559#M8911</link>
      <description>&lt;P&gt;In your &lt;STRONG data-start="969" data-end="981"&gt;Notebook&lt;/STRONG&gt;, declare the parameter like this (example in PySpark):&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dbutils.widgets.text("my_param", "")
my_param_value = dbutils.widgets.get("my_param")
print(f"The pipeline library variable is: {my_param_value}")
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or in regular Python cell if not using Spark:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;import sys

# Parameters are usually passed as command line args after the script name
# e.g., sys.argv[1], sys.argv[2], etc.
print("Notebook parameters:", sys.argv)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 16:48:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4671559#M8911</guid>
      <dc:creator>Element115</dc:creator>
      <dc:date>2025-04-28T16:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable-library values in a notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4671763#M8912</link>
      <description>&lt;P&gt;I'm looking for a solution specific to the new fabric variable libraries&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 19:51:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4671763#M8912</guid>
      <dc:creator>PhilPrentiss</dc:creator>
      <dc:date>2025-04-28T19:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable-library values in a notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4672316#M8919</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/298898"&gt;@PhilPrentiss&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As of now, the new Microsoft Fabric Variable Libraries do not support direct access from notebooks. This means you cannot retrieve variable values directly using Python code or a built-in SDK method inside a standalone notebook.&lt;/P&gt;
&lt;P&gt;The current supported usage is within Data Pipelines, where you can reference variables from the variable library and then pass them as parameters into a notebook activity. Inside the notebook, you can access those parameters using methods like dbutils.widgets.get() in PySpark or sys.argv in standard Python.&lt;/P&gt;
&lt;P&gt;So, while a direct method like get_variable() may seem logical, it isn’t available yet. The only reliable workaround is to use a pipeline to pass variable values into your notebook. Microsoft may add direct notebook support in future updates, but for now, this pipeline-based method is the correct and supported approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;If this solution worked for you, kindly mark it as Accept as Solution and feel free to give a Kudos, it would be much appreciated!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 07:15:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4672316#M8919</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-04-29T07:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable-library values in a notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4845648#M12788</link>
      <description>&lt;P&gt;There is now a way to do refer to variables in notebooks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a variable library named My_Variable_Library_Name, and a variable named "LakehouseId", then to get it in a PySpark cell you would do the following:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;VariableLib = notebookutils.variableLibrary.getLibrary("My_Variable_Library_Name") 
value = VariableLib.LakehouseId 
print(value)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this here:&amp;nbsp;&lt;A href="https://medium.com/@kapil.kulshrestha/making-notebooks-smarter-in-microsoft-fabric-with-variable-libraries-505b96f31b33" target="_blank" rel="noopener"&gt;Making Notebooks Smarter in Microsoft Fabric with Variable Libraries | by Kapil Kulshrestha | Medium&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if you want to assign a notebook to a specific lakehouse, your can do that with variable library entries like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;%%configure
{
  "defaultLakehouse": {
    "name": {
      "variableName": "$(/**/myVL/LHname)" 
    },
    "id": {
      "variableName": "$(/**/myVL/LHid)"
    },
    "workspaceId": "&amp;lt;(optional) workspace-id-that-contains-the-lakehouse&amp;gt;"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;where the name of the variable library is myVL, and the variables with the lakehouse name and id are LHname and LHid, respectively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More information is at&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/author-execute-notebook#spark-session-configuration-magic-command" target="_blank" rel="noopener"&gt;Develop, execute, and manage notebooks - Microsoft Fabric | Microsoft Learn.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Oct 2025 14:23:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-variable-library-values-in-a-notebook/m-p/4845648#M12788</guid>
      <dc:creator>andyparkerson</dc:creator>
      <dc:date>2025-10-08T14:23:37Z</dc:date>
    </item>
  </channel>
</rss>

