GS
← All work

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 upstream

Add zone attribute to pytz timezone objects

{{ modules.pytz.timezone('America/New_York').zone }}

→ '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 upstream

Implement pytz.all_timezones and all_timezones_set

{{ modules.pytz.all_timezones | length }}

→ the 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 review

Accept zone keyword argument in pytz.timezone()

{{ modules.pytz.timezone(zone='US/Eastern') }}

→ US/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

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

Linked from 5 other items

Open the full graph →