liveBook · Manning

Holidays

As explained in Snowflake Data Engineering

holidays is a Python package that provides holiday calendars and date-based holiday determination.

holidays is a Python package for determining whether dates are holidays in a specified country. It can support a date dimension whose holiday flags help operational teams plan demand around closures and seasonal peaks. section 6.2 section 6.4

Use the package in either of these implementation contexts:

  • In a Snowpark Python worksheet or stored procedure, select the holidays package as a dependency and call holidays.country_holidays(p_country). section 6.2
  • In client-side Python, install the package locally, generate dates, and combine each date with the Boolean result of an is_holiday function. section 6.4
  • Pass the country explicitly because holiday calendars vary by country; the examples use US and compare results with FR. section 6.2

Country-aware date checks

A procedure call such as PROC_IS_HOLIDAY('2024-01-01', 'US') returns True. July 4 returns True for US and False for FR, while July 14 returns False for US and True for FR. section 6.2

create or replace procedure PROC_IS_HOLIDAY(p_date date, p_country string)
    returns String
    language python
    runtime_version = 3.8
    packages =('holidays==0.29', 'snowflake-snowpark-python==*')
    handler = 'is_holiday'
    comment = 'The procedure returns True if the date is a holiday in the country'
    as '
# The Snowpark package is required for Python Worksheets
import snowflake.snowpark as snowpark
# Adding the holidays package
import holidays
def is_holiday...     #1
';

Inspect the complete Snowpark procedure definition, including the holidays dependency, Python runtime, handler, and country-aware function. section 6.2

How Snowflake Data Engineering covers it

How deep it goes
Demonstrates country selection, date membership checks, package setup, and date-dimension integration without detailing calendar internals.
Examples
Uses US and French holiday checks, January 1 and July 4, and a five-day January 2023 date list.
What it assumes
Assumes basic Python and Snowpark familiarity, while showing package installation and dependency selection for local and server-side execution.
What you can do after
Build it from scratch by producing country-aware holiday flags in Snowpark procedures or local Python date-dimension pipelines.
How it connects
Connects Python, Snowpark Python, stored procedures, Python worksheets, and date dimensions.

This explainer was generated by Manning's knowledge graph from the text of Snowflake Data Engineering. The section links point to the parts of the book it draws on.