How to Use Uuidv7 in Python, Django and Postgresql
Postedabout 2 months agoActiveabout 2 months ago
paulox.netTechstory
calmpositive
Debate
20/100
Uuidv7PythonDjangoPostgresql
Key topics
Uuidv7
Python
Django
Postgresql
The article explains how to use UUIDv7 in Python, Django, and PostgreSQL, providing a practical guide for developers.
Snapshot generated from the HN discussion
Discussion Activity
Light discussionFirst comment
3h
Peak period
3
13-14h
Avg / period
1.7
Key moments
- 01Story posted
Nov 14, 2025 at 4:21 PM EST
about 2 months ago
Step 01 - 02First comment
Nov 14, 2025 at 7:24 PM EST
3h after posting
Step 02 - 03Peak activity
3 comments in 13-14h
Hottest window of the conversation
Step 03 - 04Latest activity
Nov 15, 2025 at 6:18 AM EST
about 2 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45932331Type: storyLast synced: 11/20/2025, 1:23:53 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
It gets even worse if more than one backend has the ability to create entires that need to be in precise chronological order, either inserted “immediately” to a master DB or via eventual consistency through geographically distributed backends+DBs.
Sure, you can also use separate timestamp columns, but the timestamp portion of v7 appears to be sufficient for most use cases anyhow -- why have redundant data?
I believe I have recently bookmarked a trigger for MSSQL Server that is meant to autogenerate a UUIDv7 for an identity column, will try to link here later if anyone signals interest.
Regarding the timestamp, a dedicated column generated by the database from uuid_extract_timestamp() can be very practical in Django. It is written at insert time by PostgreSQL, defined declaratively in the model with GeneratedField, and handled entirely by the ORM without relying on triggers. It also makes filtering, ordering or using the Django admin faster and simpler, since querying on a proper datetime field avoids extra annotations or computation on the UUID expression.
If you have a reference for UUIDv7 support in MSSQL I’d really appreciate it, ideally from the official documentation. I’m also curious to know from which version it is available and whether the current Django MSSQL backend exposes it already.
So, as usual, “it depends”. ;-)
There is some discussion whether or not to add helpers for this to Python‘s uuid7 module: https://github.com/python/cpython/issues/130843#issuecomment...
2 more comments available on Hacker News