CONCAT to update db text field

I am developer/code-reviewer/debugger/bug-fixer/architect/teacher/builder from dubai, uae
Search for a command to run...

I am developer/code-reviewer/debugger/bug-fixer/architect/teacher/builder from dubai, uae
No comments yet. Be the first to comment.
You Should Tell Yourself

A URL shortener is a proxy service that provides a mapping between the short and full representation of a URL. The short URL has the advantage of being small. The service can also provide useful analy

Listening to the Mel Robbins's podcast on regrets was a 'ear'-opener. One can have reqrets of action or inaction. 4 types of reqrets foundation - should've done the work boldness - should've taken t

We need to create a unique ID generator for our high-traffic web application, generating about 10K IDs/second. The IDs can't simply be monotonically increasing integers, which are good for data access
doing + telling

I needed to collect messages from different processes which was triggered by a record insertion. To keep things simple and denormalized, this stack overflow gem allows for that.
from django.db import models
class DBModel(models.Model):
@classmethod
def append_text(cls, event_id, text_field, message)
cls.objects.filter(id=event_id).update(
text_field=Concat(text_field, Value(message))
)
Using the database function CONCAT, it offloads serializability to the database guaranteeing no race conditions.
Concat(ConcatPair(F(text_field), Value(message)))
Using F methods, it simply appends message to the existing field.
Happy hackin’!
Reference: