Skip to content

Instantly share code, notes, and snippets.

@MarkPryceMaherMSFT
Created January 9, 2025 14:57
Show Gist options
  • Save MarkPryceMaherMSFT/11cbca03fe8a85fc6a778703f3c3a959 to your computer and use it in GitHub Desktop.
Save MarkPryceMaherMSFT/11cbca03fe8a85fc6a778703f3c3a959 to your computer and use it in GitHub Desktop.
lakehouse and sql endpoint details
import json
import time
import struct
import sqlalchemy
import pyodbc
import notebookutils
import pandas as pd
from pyspark.sql import functions as fn
from datetime import datetime
import sempy.fabric as fabric
from sempy.fabric.exceptions import FabricHTTPException, WorkspaceNotFoundException
## not needed, but usefull
tenant_id=spark.conf.get("trident.tenant.id")
workspace_id=spark.conf.get("trident.workspace.id")
lakehouse_id=spark.conf.get("trident.lakehouse.id")
lakehouse_name=spark.conf.get("trident.lakehouse.name")
sql_endpoint= fabric.FabricRestClient().get(f"/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}").json()['properties']['sqlEndpointProperties']['connectionString']
sqlendpoint_id = fabric.FabricRestClient().get(f"/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}").json()['properties']['sqlEndpointProperties']['id']
sqlendpoint_displayname = fabric.FabricRestClient().get(f"/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}").json()['displayName']
#Instantiate the client
display(sqlendpoint_displayname)
#j_son = fabric.FabricRestClient().get(f"/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}").json()
#display(j_son)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment