Using Python to Build a Microsoft Fabric Ontology
In this video we'll explore how to build a Microsoft Fabric ontology entirely using Python code. We'll walk through three different approaches, including how to automatically generate properties by reading lakehouse schemas with PySpark, and we'll look at the REST payloads needed to deploy the structure. We'll use a trucking data model to show you how to define entities, keys, and relationships, and then run the notebook to automatically validate and deploy the ontology to Fabric.
Description
In this video you'll learn how to build an entire ontology using Python code in a Fabric notebook, giving you full control over entities, relationships, and properties while automating the entire deployment through the Fabric REST API.
In this video
1. Three ways to build a Fabric Ontology
o Manual configuration in the Fabric UI
o Bootstrapping from a Semantic Model
o Creating the ontology using Python and the Fabric REST API
2. How to define entities, keys, and relationships using Python
3. Using PySpark to read lakehouse schemas and automatically generate ontology properties
4. Building the REST payloads required to create the ontology
5. Running the notebook to automatically deploy and validate the ontology
We’ll use the same long-haul trucking data model from my previous video and reproduce the entire ontology automatically from a Fabric notebook.
https://youtu.be/HrWErMwKjbI
This approach provides:
• Full control over ontology design
• A repeatable deployment process
• Version-able infrastructure you can store in GitHub
Code in GitHub:
👉 https://github.com/robkerr/trucking-ontology/blob/main/notebooks/03_create_ontology.ipynb
0:00 Introduction
1:48 Code Review
3:22 Notebook run
3:52 Output Review