Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2026 03:02 AM
Thanks Lou, based on your feedback I found another way.
When importing
databricks.sdk.runtime import display
i can force python to use databricks implementation even in modules.
The full code results in
import os
if "DATABRICKS_RUNTIME_VERSION" in os.environ:
from databricks.sdk.runtime import display as db_display
else:
db_display = None # pylint: disable=invalid-name
def df_show(data) -> None:
""" Wrapper to display dataframes in both, databricks and local environment
"""
if db_display is not None:
db_display(data)
else:
print(data.show(10))
Which solves the initial question. Now it's to be decided if we should keep logic and visualization separate.