Home > Software design >  SQLAlchemy: JSON_ARRAY_APPEND?
SQLAlchemy: JSON_ARRAY_APPEND?

Time:12-09

I need to update a JSON type column in a MySQL database using JSON_ARRAY_APPEND. I can't just use python's .append() because this operation needs to occur on the database level to avoid race conditions.

Is this possible to do with SQLAlchemy?

CodePudding user response:

Yes, you can use database builtin functions thanks to func:

from sqlalchemy import func

func.json_array_append(...)
  • Related