Forum Discussion
detect runtime
- 1 year ago
The problem requires a code that runs across platforms
sys.modulesand returns unique values related to 'fabric' or 'databricks' or a key that contains 'fabric' or 'databricks' .
I am still open for a better solution but for now I can survive with this.
I need a code that can run both in databricks and fabric notebooks
Hi smpa01 ,
Detecting the environment in a notebook whether it's running on Microsoft Fabric or Databricks requires different methods since both platforms handle runtime details differently. Unfortunately, there's no universal way to do this across both environments.
Each platform has its own way of providing system information:
1. Microsoft Fabric Notebooks - Microsoft Fabric relies on notebookutils.runtime.context to fetch session, notebook, and workspace details. However, this API is specific to Fabric and isn't available in Databricks.
2. Databricks provides the DATABRICKS_RUNTIME_VERSION environment variable, which shows the runtime version. This variable is specific to Databricks and is not available in Microsoft Fabric.
FYI
- smpa011 year agoCommunity Champion
The problem requires a code that runs across platforms
sys.modulesand returns unique values related to 'fabric' or 'databricks' or a key that contains 'fabric' or 'databricks' .
I am still open for a better solution but for now I can survive with this.
- V-yubandi-msft1 year agoCommunity Support
You managed to find a temporary solution, so it's best to mark it as accepted. This will be helpful for others facing the same issue for now.