Semantic link functions for holidays
The `semantic-link-functions-holidays` library provides semantic functions, such as `is_holiday`, that enable the enrichment of a FabricDataFrame with public holiday information. It is part of the broader Microsoft Fabric semantic link feature, designed to bridge Power BI datasets and Synapse Data Science notebooks. The current version is 0.14.0, released on March 17, 2026, with updates typically tied to the `semantic-link` project's release cadence.
Warnings
- gotcha This library is primarily designed for use within Microsoft Fabric Synapse Data Science notebooks. While parts of `sempy` can be installed standalone, the full integration and benefits of semantic functions are realized in the Fabric environment.
- gotcha Semantic functions like `is_holiday` are not directly imported but are dynamically exposed as methods on a `FabricDataFrame`. This occurs when the DataFrame contains columns with appropriate data types and metadata (e.g., 'date' and 'country' columns with 'Date' and 'Country' data categories).
- gotcha The `semantic-link-functions-holidays` package wraps the `holidays` Python package. Any underlying issues, breaking changes, or specific usage patterns related to the `holidays` package might indirectly affect this semantic function.
- gotcha For a complete Semantic Link experience, it is often recommended to install the meta-package `semantic-link` (`pip install semantic-link`). This ensures all individual semantic link function packages, including holidays, are installed. Only installing `semantic-link-functions-holidays` will limit available functionality.
- gotcha In Microsoft Fabric with Spark 3.4 or later, the core `semantic-link` package is preinstalled. However, specific function packages like `semantic-link-functions-holidays` may still need to be explicitly installed or updated to their latest version.
Install
-
pip install semantic-link-functions-holidays -
pip install semantic-link
Imports
- FabricDataFrame
from sempy.fabric import FabricDataFrame
Quickstart
from sempy.fabric import FabricDataFrame
import pandas as pd
# Create a FabricDataFrame with relevant columns and metadata
# In a real Microsoft Fabric environment, FabricDataFrame often comes from reading a Power BI semantic model.
df = FabricDataFrame(
pd.DataFrame({
"country": ["US", "AT", "DE", "US"],
"date": ["2023-01-01", "2023-01-06", "2023-10-03", "2023-07-04"]
}),
column_metadata={
"country": {"data_category": "Country"},
"date": {"data_category": "Date"}
}
)
# The is_holiday function is dynamically exposed if appropriate columns and metadata exist.
# It will return True if the date is a holiday in the given country.
df["is_public_holiday"] = df.is_holiday(col_country="country", col_date="date")
print(df)