MagicStack / MagicStack/asyncpg
Use UTC for `timestamp without time zone`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
`asyncpg` converts timestamps to `datetime.datetime`. If a column has type `timestamp without time zone` then the datetime object's `.tzinfo` is `None`. This means `datetime` implicitly treats this datetime as if it is local, and source code has to replace tzinfo for every column that has `timestamp without time zone`.
I'd expect that when developers specify no timezone it is intended to be UTC, otherwise timezone would be specified in the postgres datatype?
With this in mind it makes sense to provide UTC timezone type when creating `datetime.datetime` objects from columns that do not specify timezone (at least IMO).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating asyncpg's PostgreSQL timestamp conversion entry point and the tests covering timestamp without time zone values. Review the current naive-datetime behavior and its compatibility implications; done should be a documented, tested decision about whether these values receive UTC tzinfo.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100