marivo.semantic.hour_prefix#

marivo.semantic.hour_prefix(prefix, /, *, sample_interval=None)[source]#

Declare an hour-only partition parse using a day prefix column.

Use as the parse= value on @ms.time_dimension(...) when the source column encodes only the hour component (e.g. "01", "23") and must be combined with a day-level time dimension prefix. The physical column type (string or integer) is inferred from the ibis expression at analysis time.

Parameters:
  • prefix (str) – The semantic id of a day-level time dimension that supplies the date context for this hour column.

  • sample_interval (tuple[int, Literal['minute', 'hour']] | None) – Optional (count, unit) declaring the periodic sampling cadence (e.g. (1, "hour") for hourly samples). When set, the time dimension can serve as a sampled-fold axis.

Returns:

An HourPrefixParse value object.

Return type:

HourPrefixParse

Example

>>> @ms.time_dimension(entity=logs, granularity="hour",
...                    parse=ms.hour_prefix("ops.logs.dt"))
... def hh(logs):
...     return logs.hh
>>> @ms.time_dimension(entity=logs, granularity="hour",
...                    parse=ms.hour_prefix("ops.logs.dt",
...                                        sample_interval=(1, "hour")))
... def hh(logs):
...     return logs.hh