Database Insert/Update/Delete from JSON

Please consider a database query “users”:

[
    {
        "id": 1,
        "name": "George",
        "country": "NL"
    },
    {
        "id": 2,
        "name": "Teodor",
        "country": "BG"
    }
]

That’s a JSON representation of our rows. Through a series of steps, I modify the names:

[
    {
        "id": 1,
        "name": "George P.",
        "country": "NL"
    },
    {
        "id": 2,
        "name": "Teodor T.",
        "country": "BG"
    }
]

Now, I want to UPDATE the database with the new data.

Current solution involves:

Repeat users:
    Database update

This means, two database queries will be executed. Imagine we have 1000 rows, 1000 database queries would be executed.

But just a couple of queries could be enough to update this data, following my previous research of doing an INSERT/UPDATE with multiple values/rows in it:

This feature request is for the addition of new alternatives to Database Insert, Update and Delete steps that take as input the table name and the JSON representation of rows (as exampled above). This would be an alternative to the traditional database query dialog, and a faster one (in computer speed) due to the ability to automatically “compress” inserts/updates/deletes into a single (or comparably small) query (something similar to a database transaction)

Database insert/update/delete from JSON representation is already present in software like Directus and NocoDB, bring it to Wappler!

Edit: I remembered about the potential security risks - this should not be used when accepting the entire JSON as user input (e.g.: if the user changes the id in the JSON, then s(he) could potentially be changing another user’s record. To prevent these, check how other frameworks are implementing these checks/guards, such as Laravel:


Wappler could equally accept a “fillable” or “guarded” options to protect against mass-assignment misuse

That would be amazing!