Open source · dbt · Rust
Fixing the tool I use every day
dbt's new engine is written in Rust, and its Jinja timezone module didn't yet behave like Python's pytz in dbt v1. Macros that worked before quietly broke. I picked three gaps from the pytz parity epic (#16964) and fixed them.
2 merged upstream
1 in review
2 issues closed
#16980 · fixes #16970
Merged upstreamAdd zone attribute to pytz timezone objects
{{ modules.pytz.timezone('America/New_York').zone }}→ '' (empty string)'America/New_York'
Implemented get_value on PytzTimezone so .zone returns the canonical name (Tz::name()), matching Python pytz in dbt v1.
#16982 · fixes #16966
Merged upstreamImplement pytz.all_timezones and all_timezones_set
{{ modules.pytz.all_timezones | length }}→ 0the full count of IANA zones
Backed by chrono_tz's TZ_VARIANTS. After maintainer review I reworked it into a read-only ObjectRepr::Seq object so nothing is copied into the Jinja context, made the set lazy, and added an ordering test.
#16981 · fixes #16972
Open, awaiting reviewAccept zone keyword argument in pytz.timezone()
{{ modules.pytz.timezone(zone='US/Eastern') }}→ error: timezone() requires a string name argumentUS/Eastern timezone
Parsed arguments with ArgParser (the pattern datetime.timezone already uses) so zone works by name or position.
What I learned
- Reading an unfamiliar Rust codebase by following one behavior end to end, from the Jinja call to the module.
- Writing the failing test first, then verifying the fix with a real dbt project built from source.
- Taking review well: the maintainer's suggestion made #16982 simpler and cheaper, and I said so.
Also contributed
snowflakedb/snowpark-python · Open
PR #4455: accept bytes values in SessionBuilder config type hints (SNOW-2404739)databricks/databricks-agent-skills · Reported
Issue #296: the proximity example used ST_Distance (degrees) as meters, so a "< 5000" filter matched every pair
Connections
Linked tools & methods
- RustSystems language that dbt's new engine is written in.
- dbtTransforms raw warehouse tables into tested, documented models with SQL.Also in: VirtueSoft · Ad Creative Pretest Lab · Query Guard · Grocery Growth Drivers · Dashboard walkthrough