PyCon APAC 2025 in Manila coincided with Python 3.13’s general availability (October 2024), making UUID v7 a natural focus for database and API sessions. The conference brought together Python engineers from Southeast Asia, Japan, South Korea, and Australia — many running Django or FastAPI services on PostgreSQL. Sessions highlighted that Python 3.13’s addition of uuid.uuid7() to the standard library removed the last barrier to UUID v7 adoption in Python projects. See UUID in Python for the full implementation guide.
Key topics covered
stdlib uuid.uuid7() — No external dependency needed for Python 3.13+:
import uuid
# Python 3.13+
order_id = uuid.uuid7()
print(order_id) # e.g. 018fbe3a-4c5d-7b12-8abc-0123456789ab
For Python 3.9–3.12, the community-maintained backport covers the same API:
from uuid6 import uuid7
order_id = uuid7()
See UUID in FastAPI for integrating uuid.uuid7() with Pydantic v2 and async SQLAlchemy.
Django ORM — UUID v7 migration
# models.py
import uuid
from django.db import models
class Order(models.Model):
# Before: id = models.UUIDField(primary_key=True, default=uuid.uuid4)
id = models.UUIDField(primary_key=True, default=uuid.uuid7, editable=False)
status = models.CharField(max_length=32)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
ordering = ['id'] # chronological — UUID v7 sorts by creation time
The change from uuid.uuid4 to uuid.uuid7 requires no Django migration (no schema change) — the database column type is uuid in both cases. Existing rows keep their v4 values; new rows get v7. See UUID in Databases for B-tree impact.
SQLAlchemy 2.x async pattern
from sqlalchemy import Column
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import DeclarativeBase
import uuid
class Base(DeclarativeBase):
pass
class Order(Base):
__tablename__ = 'orders'
id = Column(
UUID(as_uuid=True),
primary_key=True,
default=uuid.uuid7, # Python 3.13+
)
status = Column(str, nullable=False)
The default=uuid.uuid7 callable is invoked by SQLAlchemy before each INSERT — no database-side function required. See UUID in FastAPI for the full async SQLAlchemy handler pattern.
RFC 9562 awareness in the APAC ecosystem
Sessions noted that RFC 9562 ratification in May 2024 prompted rapid adoption across Python ORMs — SQLAlchemy 2.0, Django 5.1, and Tortoise ORM all added explicit UUID v7 documentation within months of the RFC’s publication. The RFC 9562 standard formalised what the Python community had been building with the uuid6 package since 2021.
Related events
- PyCon US 2025 — UUID v7 in Python 3.13
- DjangoCon US 2024 — UUID Primary Keys in Django
- DjangoCon Europe 2025 — UUID in Django
Further reading
- UUID in Python — full guide
- Python 3.13 adds uuid.uuid7()
- UUID in FastAPI — Pydantic and SQLAlchemy
- RFC 9562 — the current UUID standard
- UUID v4 vs v7 — which to use
External references
- PyCon APAC — official site
- Python 3.13 uuid module documentation
- uuid6 backport — Python 3.9–3.12
- RFC 9562 — UUID standard
Frequently asked questions
What Python UUID v7 content was presented at PyCon APAC 2025?
PyCon APAC 2025 sessions covered the new uuid.uuid7() function added to the Python 3.13 standard library, Django's UUIDField migration patterns from v4 to v7, and SQLAlchemy 2.x async UUID column configuration. The sessions emphasised that the migration requires no schema change — the PostgreSQL uuid column stores v4 and v7 identically. See UUID in Python — full guide.
How does uuid.uuid7() differ from the uuid6 backport package?
uuid.uuid7() in Python 3.13 is functionally equivalent to uuid6.uuid7() from the uuid6 PyPI package — both produce RFC 9562-compliant UUID v7 values. The stdlib version uses Python's os.urandom() for the random bits and the system clock for the 48-bit timestamp. For Python 3.9–3.12, install the uuid6 backport. See Python 3.13 uuid.uuid7().