Add linked records in base.insert_row

To unit-test a Python script that listens for UPDATE_DTABLE events, I would like to use the Python API to emulate the manual insertion of a row in a table that is grouped by a linked record columns. In other words, is there a way to use the Python API functionality to generate an update event of the following form:

    "op_type": "insert_row",
    "table_id": "...",
    "row_id": "...",
    "row_insert_position": "insert_below",
    "row_data": {
        "_id": "...",
        "_participants": [],
        "_creator": "...",
        "_ctime": "",
        "_last_modifier": "...",
        "_mtime": ""
    },
    "links_data": {
        "l2qt": {
            "link_table_id": "...",
            "linked_table_id": "...",
            "id_linked_rows_ids": {
                "...": [
                    "..."
                ]
            }
        }
    }
}

It doesn’t seem like I can use base.insert_row and then base.add_link, because that doesn’t result in the same event data as when a user inserts the row with the linked record into the table through the GUI.

Hi @Bram.

You have to insert a new row. The return value would be the new row id.
After that you can update the like column value.

Thanks for your reply. However, my question is if there is a way to include the link data in the row insertion step directly, so that the event data received by the listener looks like the snippet I included in my original post.

I didn’t find a solution in the docs so I would say no.