Skip to content

Commit bbf17a9

Browse files
authored
Document 1.1 timestamp normalization behavior (#815)
* Document 1.1 timestamp normalization * Fix spelling in 1.1 docs
1 parent 704dc82 commit bbf17a9

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

docs/migrations.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,34 @@ Redis OM includes a built-in migration for datetime field indexing improvements.
217217

218218
For detailed information about this migration, see the **[0.x to 1.0 Migration Guide](migration_guide_0x_to_1x.md#datetime-migration-details)**.
219219

220+
### Datetime Timezone Normalization in 1.1.0
221+
222+
Redis OM Python 1.1.0 tightens timestamp handling for both `datetime.datetime` and `datetime.date` fields:
223+
224+
- `datetime.datetime` values are read back as **UTC-aware** `datetime` values.
225+
- `datetime.date` values are stored as **midnight UTC** instead of local-midnight timestamps.
226+
227+
This is usually what you want, but it matters if you already have data written by versions before 1.1.0:
228+
229+
- Older `datetime.datetime` records still represent the same instant in time, but code that expected naive `datetime` values may need to handle UTC-aware values.
230+
- Older `datetime.date` records written in a **non-UTC** environment may load as a different calendar day after upgrading, and equality queries may stop matching those records.
231+
232+
If you have existing `datetime.date` data from a release before 1.1.0 and your application was not running in UTC, plan to migrate or re-save that data after upgrading.
233+
234+
Example symptom after upgrade:
235+
236+
- Stored before 1.1.0 in `Asia/Karachi`: `date(2023, 1, 1)` -> `1672513200` (local midnight)
237+
- Stored in 1.1.0+: `date(2023, 1, 1)` -> `1672531200` (midnight UTC)
238+
239+
If your application relies on date equality queries, verify old records after upgrading:
240+
241+
```bash
242+
# Spot-check records after upgrading
243+
om migrate-data status
244+
```
245+
246+
If needed, create a custom data migration to normalize affected `datetime.date` fields by re-saving them with Redis OM 1.1.0+.
247+
220248
## Advanced Usage
221249

222250
### Module-Based Migrations

docs/release_notes_1.1.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Redis OM Python 1.1 Release Notes
2+
3+
Redis OM Python 1.1 focuses on compatibility updates and timestamp normalization fixes.
4+
5+
## Notable Changes
6+
7+
- RedisVL dependency updated to allow newer Python versions
8+
- `datetime.datetime` values now round-trip as UTC-aware `datetime` values
9+
- `datetime.date` values now store as midnight UTC instead of local-midnight timestamps
10+
11+
## Timestamp Upgrade Note
12+
13+
The timestamp normalization change is important if you already have data written by earlier releases:
14+
15+
- Existing `datetime.datetime` records still represent the same instant in time, but code that expected naive `datetime` values may need to handle UTC-aware values.
16+
- Existing `datetime.date` records written in a non-UTC environment may load as a different calendar day after upgrading.
17+
- Date equality queries may stop matching those older records until the data is re-saved or migrated.
18+
19+
For migration guidance, see [Migrations: Datetime Timezone Normalization in 1.1.0](migrations.md#datetime-timezone-normalization-in-110).

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ nav:
7272
- Reference:
7373
- Errors: errors.md
7474
- Release Notes 1.0: release_notes_1.0.md
75+
- Release Notes 1.1: release_notes_1.1.md
7576
- Upgrade Guide (0.x → 1.x): migration_guide_0x_to_1x.md
7677

7778
plugins:
@@ -105,4 +106,3 @@ extra_css:
105106

106107
copyright: |
107108
&copy; 2024 <a href="https://github.com/redis" target="_blank" rel="noopener">Redis</a>
108-

0 commit comments

Comments
 (0)