Skip to content

Instantly share code, notes, and snippets.

@mark-mishyn
Last active June 13, 2021 15:22
Show Gist options
  • Save mark-mishyn/3c4155245670d31df8dd6d5579b23f81 to your computer and use it in GitHub Desktop.
Save mark-mishyn/3c4155245670d31df8dd6d5579b23f81 to your computer and use it in GitHub Desktop.
Append value to DB column with Django ORM with 1 QB query
from django.db.models import F, Value
from django.db.models.functions import Concat
# only one SQL query
User.objects.filter(id=user.id).update(description=Concat(F('description'), Value('some note to append')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment