Code Explainers

Code explainers tagged #bulk-update

python
from django.db import models
from django.db.models import F, Sum, DecimalField
from django.db.models.functions import Coalesce
 

Recomputing order totals in Django

annotations aggregation custom-manager
Intermediate 9 steps
python
from django.db import transaction
from django.db.models import F
from django.http import JsonResponse
from django.views.decorators.http import require_POST

Safely reordering tasks with a Django action

transactions row-locking validation
Advanced 8 steps
java
@Repository
public interface SubscriptionRepository extends JpaRepository<Subscription, Long> {
 
    @Modifying(clearAutomatically = true, flushAutomatically = true)

Bulk JPQL updates in a Spring Data repository

jpql bulk-update modifying-query
Intermediate 5 steps
python
from decimal import Decimal, ROUND_HALF_UP
 
from django.db import transaction
from django.db.models import F

Batch price updates safely in Django

decimal-precision batch-processing transactions
Advanced 8 steps
ruby
class TasksController < ApplicationController
  before_action :set_project
 
  def reorder

Bulk task reordering with upsert_all in Rails

bulk-update upsert authorization
Intermediate 8 steps