Skip to content

yggdrasil.arrow.tzdata

tzdata

Ensure pyarrow can locate a tzdata database on Windows.

pyarrow ships without a bundled IANA timezone database. On Windows it looks at %PYARROW_TZDATA_PATH% (or %USERPROFILE%\Downloads\tzdata if unset) and fails with ArrowInvalid: Unable to get Timezone database version when that directory is missing, empty, or stale.

pyarrow's own pyarrow.util.download_tzdata_on_windows() has no retry, no timeout, and no meaningful error — it silently leaves the target directory in an unusable state when a corporate proxy blocks the IANA download. This module repairs that state: it probes with pyarrow.compute.assume_timezone (the call that actually hits the tz database), cleans up partial installs, runs pyarrow's downloader, and falls back to a manual stdlib download with retries if that fails.

ensure_tzdata

ensure_tzdata(*, force: bool = False, raise_on_failure: bool = False) -> bool

Make pyarrow's tzdata lookup succeed on Windows.

Returns True when a timezone-aware timestamp operation works at the end of the call, False otherwise. No-op (returns True) on non-Windows platforms and on repeat calls once a positive result has been cached.

Parameters

force: Bypass the cached positive result and rerun the probe + repair. raise_on_failure: Raise RuntimeError with manual-fix instructions when the final canary still fails. Useful at the top of scripts/tests that depend on timezone support.