snowflake.snowpark.types.YearMonthIntervalType

class snowflake.snowpark.types.YearMonthIntervalType(start_field: Optional[int] = None, end_field: Optional[int] = None)[source]

Bases: _AnsiIntervalType

YearMonthIntervalType data type. This maps to the INTERVAL YEAR TO MONTH data type in Snowflake.

Parameters:
  • start_field – The start field of the interval (0=YEAR, 1=MONTH)

  • end_field – The end field of the interval (0=YEAR, 1=MONTH)

Notes

YearMonthIntervalType is currently in private preview since 1.38.0. It needs to be enabled by setting parameter FEATURE_INTERVAL_TYPES to ENABLED.

Support for YearMonthIntervalType in UDFs and Stored Procedures requires the ENABLE_INTERVAL_TYPES_IN_UDF account parameter to be enabled. Use YearMonthInterval as the Python type annotation; values are passed as the total number of months (int).

Methods

jsonValue()

json_value()

simpleString()

simple_string()

Attributes

MONTH

Constant representing the MONTH field for interval start/end positions

YEAR

Constant representing the YEAR field for interval start/end positions