This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
The Get Data with Cloud Connection is a cross-Fabric capability that supports a broad range of data sources—including Azure Blob Storage, PostgreSQL, Azure Key Vault, S3, and many more.
Now available directly within notebooks, this feature empowers users to efficiently and securely access and manage data from diverse sources. Importantly, it provides a secure way to handle data source credentials inside notebooks, ensuring your data connections are both convenient and protected.
This release supports only cloud data sources. For the on-premises data source, please choose Managed Private Endpoint to access the on-premises data.
You can create the connection from inside Notebook’s New Connection flow and from the Fabric data source management page.
To create a new connection inside notebook:
Create_a_Fabric_Connection_with_the_build-in_flow_inside_notebook._User_can_choo
Once the connection is created, it will show under the Current Notebook node, indicating it is linked to the notebook and ready to use.
Enable_this_connection_can_be_used_inside_the_code-first_artifact_such_as_Notebo
2. After creating the connection, it appears under Global permissions, ready to link to the notebook. Selecting Connect in the context menu should link this connection to the notebook.
Once the Fabric Connection is created and bound to the current notebook, you can generate code snippets to access the data source directly from the notebook.
Generate_the_python_code_snippet_from_the_connection._The_credential_detail_will
The code retrieves the connection credentials, uses them to set up the data source client, and then runs a query, which you can modify as needed. If the required packages aren't present in the runtime, a preceding code cell with a pip install command appears. Run that cell before running the query.
The following is an example of code snippet generated for an Azure SQL Cosmos DB connection:
from azure.cosmos import CosmosClient
import json
import pandas as pd
connection_id = '9d405da3-3d11-481a-9022-xxxxxxxxxxx' # connection name: "neweventdb qixwang"
connection_credential = notebookutils.connections.getCredential(connection_id)
credential_dict = json.loads(connection_credential['credential'])
key = next(item['value'] for item in credential_dict['credentialData'] if item['name'] == 'key')
endpoint = 'https://userevent.documents.azure.com:443/'
client = CosmosClient(endpoint, credential=key)
databases = list(client.list_databases())
database = databases[0]
database_client = client.get_database_client(database['id'])
containers = list(database_client.list_containers())
container = containers[0]
container_name = container['id']
container_client = database_client.get_container_client(container_name)
query = f"SELECT * FROM {container_name} p"
items = list(container_client.query_items(query=query, enable_cross_partition_query=True))
df = pd.DataFrame(items)
display(df)
To learn more, refer to Fabric connection inside Notebook and share your feedback in the Fabric Data engineering community in Fabric Ideas or Reddit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.