Simon Willison’s Weblog

Subscribe

Thursday, 13th October 2022

How to implement a “dry run mode” for data imports in Django (via) Adam Johnson describes in detail a beautiful pattern for implementing a dry-run mode for a Django management command, by executing ORM calls inside an atomic() transaction block, showing a summary of changes that are made and then rolling the transaction back at the end.

# 4:22 pm / django, transactions, adam-johnson

2022 » October

MTWTFSS
     12
3456789
10111213141516
17181920212223
24252627282930
31