Guest User

Untitled

a guest
Feb 16th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. i = 0
  2. current_pk_set = PredictionRecordModel.objects.filter(transaction_id__isnull=True).values_list("pk", flat=True)[:10000]
  3. while i < 50 and current_pk_set:
  4. print(i)
  5. PredictionRecordModel.objects.filter(pk__in=current_pk_set).update(transaction_id=F('yodlee_transaction_id'))
  6. current_pk_set = PredictionRecordModel.objects.filter(transaction_id__isnull=True).values_list("pk", flat=True)[:10000]
  7. i += 1
  8.  
  9. # Post Checks
  10. with_strs = PredictionRecordModel.objects.all().annotate(yod_as_str=Cast('yodlee_transaction_id', CharField()))
  11. assert with_strs.filter(yod_as_str=F('transaction_id')).count() == PredictionRecordModel.objects.all().count()
Add Comment
Please, Sign In to add comment