Skip to content

featurebyte.ForecastPointSchema

class ForecastPointSchema(
*,
granularity: TimeIntervalUnit,
dtype: DBVarType="DATE",
format_string: Optional[str]=None,
is_utc_time: Optional[bool]=None,
timezone: Union[TimeZoneName, TimeZoneColumn, NoneType]=None
)

Description

Schema for a forecast point column in observation tables. The forecast point represents the future date/time being predicted for, as opposed to POINT_IN_TIME which represents when the prediction is made.

The FORECAST_POINT column is always string-based (DATE, TIMESTAMP, or VARCHAR), and the schema defines how to interpret the granularity and timezone.

Parameters

  • granularity: TimeIntervalUnit
    The time granularity of the forecast point (DAY, WEEK, HOUR, etc.) For WEEK granularity, the column still contains date values (e.g., week start date)

  • dtype: DBVarType
    default: "DATE"
    The data type of the forecast point column (DATE, TIMESTAMP, TIMESTAMP_TZ, or VARCHAR)

  • format_string: Optional[str]
    Database-specific format string if the column is stored as VARCHAR. Required for VARCHAR dtype, must not be provided for native date/timestamp types.

  • is_utc_time: Optional[bool]
    Whether the forecast point values are in UTC (True) or local time (False)

  • timezone: Union[TimeZoneName, TimeZoneColumn, NoneType]
    Global timezone setting, or reference to a FORECAST_TIMEZONE column. Required when is_utc_time is False.

Examples

Example 1: Daily forecast with local timezone column

>>> forecast_schema = fb.ForecastPointSchema(
...     granularity=fb.TimeIntervalUnit.DAY,
...     dtype=fb.DBVarType.DATE,
...     is_utc_time=False,
...     timezone=fb.TimeZoneColumn(column_name="FORECAST_TIMEZONE", type="timezone"),
... )
Example 2: Weekly forecast with global timezone (week start dates)

>>> forecast_schema = fb.ForecastPointSchema(
...     granularity=fb.TimeIntervalUnit.WEEK,
...     dtype=fb.DBVarType.DATE,
...     timezone="America/New_York",
... )
Example 3: Hourly forecast with VARCHAR format

>>> forecast_schema = fb.ForecastPointSchema(
...     granularity=fb.TimeIntervalUnit.HOUR,
...     dtype=fb.DBVarType.VARCHAR,
...     format_string="YYYY-MM-DD HH24:MI:SS",
...     is_utc_time=True,
...     timezone="Etc/UTC",
... )

See Also

  • TimestampSchema: Schema for a timestamp column that can include timezone information.
  • Context: Context class that can include a forecast_point_schema.