HomeElementl

Maintain backcompat in date_partition_range

Description

Maintain backcompat in date_partition_range

Summary:
I did not realize that this was part of the public API that we expose to users.

Shockingly, it does not seem to be possible to use timedelta objects (or relativedelta objects) in a timezone-safe way:

>>> dt = pendulum.create(2020, 3, 8, tz="US/Central")
>>> dt + timedelta(days=1)
<Pendulum [2020-03-09T01:00:00-05:00]> # wtf, 1 AM
>>> dt + relativedelta(days=1)
<Pendulum [2020-03-09T01:00:00-05:00]> # wtf, 1 AM
>>> dt + pendulum.interval(days=1)
<Pendulum [2020-03-09T01:00:00-05:00]> # wtf, 1 AM
>>> dt.add(days=1)
<Pendulum [2020-03-09T00:00:00-05:00]> # Seems to be the only way to actually add a day correctly

So I removed the timedelta argument to date_partition_range in https://dagster.phacility.com/D4725. But users use that as well.

This does not cover every conceivable input that might have previously gone into this function, but I will hazard a guess without data that 99% if not 100% of all previous usage was timedelta(days=1). The function is also a bit hacky but we should rmeove the delta parameter altogether (will add an issue for that), at which point we can remove it.

Test Plan: BK coverage in test_utils modified to include both delta and delta_range params (will beef it up a bit more now).

Reviewers: sashank, alangenfeld, prha

Reviewed By: prha

Differential Revision: https://dagster.phacility.com/D4813

Details

Provenance
dgibsonAuthored on Oct 19 2020, 7:26 PM
Reviewer
prha
Differential Revision
D4813: Maintain backcompat in date_partition_range
Parents
R1:adb7d5f2abcd: Append "_location" to default repository location name
Branches
Unknown
Tags
Unknown