{"id":98641,"date":"2023-10-30T17:00:57","date_gmt":"2023-10-30T17:00:57","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=98641"},"modified":"2024-09-03T20:15:17","modified_gmt":"2024-09-03T20:15:17","slug":"sql-endpoints-and-lakehouse-ui-differences-and-access-secrets","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/bi-sql-server\/sql-endpoints-and-lakehouse-ui-differences-and-access-secrets\/","title":{"rendered":"SQL Endpoints and Lakehouse UI Differences and Access Secrets"},"content":{"rendered":"<p>There are some differences and secrets between the UI of a <strong>SQL Endpoint<\/strong> and the UI of a <strong>Lakehouse<\/strong>.<\/p>\n<p>I believe the <strong>lakehouse<\/strong> UI was changed recently, otherwise you can blame me for being distracted to this level. Let&#8217;s analyze the differences and pending points between these UI&#8217;s.<\/p>\n<h2>SQL Endpoints<\/h2>\n<p>When using a <strong>SQL Endpoint<\/strong>, we can add multiple <strong>lakehouses<\/strong> to the explorer. They\u00a0are included in the vertical, one above another. This is one of the differences between a <strong>SQL Endpoint<\/strong> and the <strong>lakehouse<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"278\" height=\"236\" class=\"wp-image-98642\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>On the top of Explorer, the button is called <em>&#8220;+ Warehouses&#8221;.<\/em> This may be a bit confusing because we are working with a <strong>lakehouse<\/strong>. The fact is we can add either a <strong>lakehouse<\/strong> or <strong>data warehouses<\/strong> to the explorer.<\/p>\n<h2>Domains and Workspaces<\/h2>\n<p>The <strong>Microsoft Fabric<\/strong> portal has the domain feature in preview. Domains are a concept from the <strong>Data Mesh<\/strong> architecture, but this is a subject for a different and longer article.<\/p>\n<p>What&#8217;s important to understand is that domains allow us to create a set of workspaces and make some limited management tasks to the entire set.<\/p>\n<p>The access to the domains management is done through the <strong>Power BI Admin portal<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"402\" height=\"815\" class=\"wp-image-98643\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-1.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>On the left side of the window, we click on <strong>Domains<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"272\" height=\"512\" class=\"wp-image-98644\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-screen-description-aut.png\" alt=\"A screenshot of a computer screen\n\nDescription automatically generated\" \/><\/p>\n<p>In my environment, I already have many domains created.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1078\" height=\"451\" class=\"wp-image-98645\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-2.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>During the preview stage, there are very few configurations we can manage:<\/p>\n<ul>\n<li>The Domain Admins<\/li>\n<li>The Domain Contributors<\/li>\n<li>Workspaces belonging to the domain<\/li>\n<li>Data certification rules for the domain<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"864\" height=\"706\" class=\"wp-image-98646\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-3.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"690\" class=\"wp-image-98647\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-4.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>The fact of whether a workspace is linked to a domain or not affects how the <strong>SQL Endpoint<\/strong> and <strong>Lakehouse<\/strong> window works.<\/p>\n<h2>Adding a Storage to the SQL Endpoint<\/h2>\n<p>There are some curious behaviors in relation to the <strong>SQL Endpoint<\/strong> and the domain management.<\/p>\n<p>If the workspace doesn&#8217;t belong to a domain, on the top right of the window we only see a <em>&#8220;Filter&#8221;<\/em> dropdown. Using this limited option, we can only add objects, either <strong>data warehouse<\/strong> or <strong>lakehouses<\/strong>, which are present in the same workspace.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1266\" height=\"225\" class=\"wp-image-98648\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-5.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>On the other hand, if the workspace belongs to a domain, we can see an additional dropdown intended to include a list of domains.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1266\" height=\"294\" class=\"wp-image-98649\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-6.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>However, this dropdown has some very singular behaviors:<\/p>\n<ul>\n<li>Only the domain of the current workspace is listed, we can&#8217;t see a list of other existing domains.<\/li>\n<li>The <em>&#8220;All Domains&#8221;<\/em> is the default option, but we don&#8217;t see objects from all domains by default. We need to change the dropdown to one domain and change back to &#8220;All Domains&#8221; in order to see all the objects.<\/li>\n<li>The <em>&#8220;All Domains&#8221;<\/em> option includes objects not linked to any domain. The objects not linked to any domain can&#8217;t see the other ones, but the other ones can see them.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1411\" height=\"438\" class=\"wp-image-98650\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-7.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<h2>Queries on the SQL Endpoint<\/h2>\n<p>Although we can add objects from different workspaces in the Explorer, we can&#8217;t query them. Any attempt to make a cross workspace query will result in an error.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"284\" class=\"wp-image-98651\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-8.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>Cross <strong>lakehouse<\/strong> work is a long subject for another article. But we can make a conclusion: <em>Either there is some missing feature being produced, or the possibility to add <\/em><strong><em>lakehouses <\/em><\/strong><em>to the explorer <\/em><em>but not being able to query them is a small method to make cross <\/em><strong><em>lakehouse<\/em><\/strong><em> queries easier (but not much).<\/em><\/p>\n<h2>The lakehouse explorer<\/h2>\n<p>We can consider there are two <strong>lakehouse<\/strong> explorers:<\/p>\n<ul>\n<li>One is accessible directly from the <strong>lakehouse<\/strong>. On this one, only the<strong> lakehouse<\/strong> can be accessible.<\/li>\n<li>The second one is accessible when we open a notebook. In this one we can add multiple <strong>lakehouses<\/strong>.<\/li>\n<\/ul>\n<p>The window to add a <strong>lakehouse<\/strong> to this explorer is very similar to the one explained in relation to the <strong>SQL Endpoints<\/strong> but some behaviors are different:<\/p>\n<ul>\n<li>All the domains are visible in this window, while on the <strong>SQL Endpoint<\/strong> only the workspace domain is visible.<\/li>\n<li>The domain dropdown is available independently if the workspace is linked to a domain or not.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1277\" height=\"341\" class=\"wp-image-98652\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-description-automatica-9.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>My developer mind keeps wondering why a window which should be the same has different behaviors depending on where it&#8217;s called from one place or another, without a clear reason for this. I would love to read your thoughts on the comments.<\/p>\n<h2>The default lakehouse<\/h2>\n<p>The first <strong>lakehouse<\/strong> included becomes the default one for the notebook.<\/p>\n<p>The notebook uses a feature called <strong>Live Pool<\/strong>. This means when we run the notebook the spark pool is created automatically for us.<\/p>\n<p>The spark pool creation process includes mounting the default <strong>lakehouse<\/strong> as a folder on file system. The path for the default <strong>lakehouse<\/strong> will be <em>\/lakehouse\/default<\/em>, with the option to access files on <em>\/lakehouse\/default\/files<\/em> or access tables on <em>\/lakehouse\/default\/tables<\/em>.<\/p>\n<p>We can use the following code to list the tables from the default <strong>lakehouse<\/strong>:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;\">\n<pre class=\"crayon:false\" style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold;\">os<\/span>\r\n\r\nfull_tables <span style=\"color: #333333;\">=<\/span> os<span style=\"color: #333333;\">.<\/span>listdir(<span style=\"background-color: #fff0f0;\">'\/lakehouse\/default\/Tables'<\/span>)\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">for<\/span> table <span style=\"color: #000000; font-weight: bold;\">in<\/span> full_tables:\r\n     <span style=\"color: #008800; font-weight: bold;\">print<\/span>(table)\r\n<\/pre>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"568\" height=\"337\" class=\"wp-image-98653\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-program-description-au.png\" alt=\"A screenshot of a computer program\n\nDescription automatically generated\" \/><\/p>\n<h2>Multiple Lakehouses on the Explorer<\/h2>\n<p>When we click on the two arrows icon, we can add new <strong>lakehouses <\/strong>to the explorer.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"264\" height=\"258\" class=\"wp-image-98654\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-search-box-description-automati.png\" alt=\"A screenshot of a search box\n\nDescription automatically generated\" \/><\/p>\n<p>The <strong>lakehouses<\/strong> are not included vertically, like on the <strong>SQL Endpoint<\/strong> explorer. They are only visible when we click again on the two arrows icon.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"282\" height=\"534\" class=\"wp-image-98655\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-search-engine-description-autom.png\" alt=\"A screenshot of a search engine\n\nDescription automatically generated\" \/><\/p>\n<p>The menu shows which one is the default <strong>lakehouse<\/strong> and allows us to change it. Changing the default <strong>lakehouse<\/strong> changes the content mounted on the folder on <em>\/lakehouse\/default<\/em>.<\/p>\n<h2>The Notebook Access to the lakehouse<\/h2>\n<p>The notebook has two different ways to access the <strong>lakehouse<\/strong>:<\/p>\n<ul>\n<li>Access the mounted <strong>lakehouse<\/strong> using the OS path<\/li>\n<li>Use <strong>Spark.SQL<\/strong> to access the <strong>lakehouses<\/strong> contained in the same workspace as the default one<\/li>\n<\/ul>\n<p>There is no method for the notebook to iterate through the <strong>lakehouses<\/strong> added to the explorer. The presence of the <strong>lakehouses<\/strong> on the explorer only helps us choose the default <strong>lakehouse<\/strong>, nothing else.<\/p>\n<p>This makes me wonder if this is only the starting stage of new features about to be released until the <strong>Microsoft Fabric<\/strong> GA version.<\/p>\n<h2>Spark.SQL on the notebook<\/h2>\n<p><strong>Spark SQL<\/strong> can access different <strong>lakehouses<\/strong>, but the ones\u00a0available to <strong>Spark SQL <\/strong>are totally independent of the <strong>lakehouses<\/strong> included in the <strong>lakehouse<\/strong> explorer.<\/p>\n<p>In summary, <strong>Spark.SQL<\/strong> can access all the <strong>lakehouses<\/strong> contained in the same workspace as the default <strong>lakehouse<\/strong>. It doesn&#8217;t matter if they\u00a0are included in the <strong>lakehouse<\/strong> explorer or not.<\/p>\n<p>We can use the following code to list the available <strong>lakehouses<\/strong> to <strong>spark.sql<\/strong>:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;\">\n<pre class=\"crayon:false\" style=\"margin: 0; line-height: 125%;\">lakehouses <span style=\"color: #333333;\">=<\/span> spark<span style=\"color: #333333;\">.<\/span>catalog<span style=\"color: #333333;\">.<\/span>listDatabases()\r\n\r\nlakehouse_list <span style=\"color: #333333;\">=<\/span> []\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">for<\/span> lakehouse <span style=\"color: #000000; font-weight: bold;\">in<\/span> lakehouses:\r\n     lakehouse_list<span style=\"color: #333333;\">.<\/span>append(lakehouse<span style=\"color: #333333;\">.<\/span>name)\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">print<\/span>(lakehouse_list)\r\n<\/pre>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"478\" height=\"271\" class=\"wp-image-98656\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-program-description-au-1.png\" alt=\"A screenshot of a computer program\n\nDescription automatically generated\" \/><\/p>\n<p>As you may notice in this example, the <strong>lakehouses<\/strong> listed are the ones in the same workspace as the default. This includes a <strong>lakehouse<\/strong> not in the Explorer and ignores others in it.<\/p>\n<p>We can go further and use <strong>spark sql<\/strong> to list the tables in the <strong>lakehouses<\/strong> using the following code:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;\">\n<pre class=\"crayon:false\" style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">for<\/span> lake <span style=\"color: #000000; font-weight: bold;\">in<\/span> lakehouse_list:\r\n    tables<span style=\"color: #333333;\">=<\/span>spark<span style=\"color: #333333;\">.<\/span>sql(f<span style=\"background-color: #fff0f0;\">'SHOW TABLES IN {lake}'<\/span>)\r\n    tablenames<span style=\"color: #333333;\">=<\/span><span style=\"color: #007020;\">list<\/span>(tables<span style=\"color: #333333;\">.<\/span>toPandas()[<span style=\"background-color: #fff0f0;\">'tableName'<\/span>])\r\n    <span style=\"color: #008800; font-weight: bold;\">for<\/span> tb <span style=\"color: #000000; font-weight: bold;\">in<\/span> tablenames:\r\n        <span style=\"color: #008800; font-weight: bold;\">print<\/span>(tb)\r\n<\/pre>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"603\" height=\"359\" class=\"wp-image-98657\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/10\/a-screenshot-of-a-computer-program-description-au-2.png\" alt=\"A screenshot of a computer program\n\nDescription automatically generated\" \/><\/p>\n<h2>Summary<\/h2>\n<p>The UI is full of small tricks and unexpected differences which make us wonder which new features are coming on the GA version to justify these inconsistencies without a clear reason.<\/p>\n<p>Meanwhile, we need to navigate these very small inconsistencies. The better we understand the relation between the <strong>lakehouse<\/strong> explorers, OS path and spark SQL, the better we will be able to make a great use of the environment.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are some differences and secrets between the UI of a SQL Endpoint and the UI of a Lakehouse. I believe the lakehouse UI was changed recently, otherwise you can blame me for being distracted to this level. Let&#8217;s analyze the differences and pending points between these UI&#8217;s. SQL Endpoints When using a SQL Endpoint,&#8230;&hellip;<\/p>\n","protected":false},"author":50808,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143528,53,159164,159166],"tags":[123646,158998,158997,101611],"coauthors":[6810],"class_list":["post-98641","post","type-post","status-publish","format-standard","hentry","category-bi-sql-server","category-featured","category-microsoft-fabric","category-powerbi","tag-data-lake","tag-lakehouse","tag-microsoft-fabric","tag-power-bi"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/98641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/50808"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=98641"}],"version-history":[{"count":7,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/98641\/revisions"}],"predecessor-version":[{"id":98971,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/98641\/revisions\/98971"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=98641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=98641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=98641"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=98641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}