Adding Row to a table needs Primary Key ID creationg

Hey there!

  • Goal: I am building an App, which is mainly for editing data from a Django Database. The table is filled by filling a database table in Retool through a workflow. The problem is, every row is getting assigned an ID during import. When creating a new row in my table component, I am not able to store it through the save handler, since it doesn't have an ID automatically generated, the primary key field "ID" is not editable in the component and can't be set as editable.

  • Steps: I tried adding a rowId by getting the max ID from the current table and adding it inside the save handler like this:
    {{ table.newRows.map(x=>{
    x.row_id= getMaxRowId + 1
    x.updated_by= current_user.fullName;
    x.updated_at= moment().format("YYYY/MM/DD HH:mm");
    x.status= "Updated";
    x.status= "New"
    return x}))}}

The save handler is set to upsert, but it seems not beeing able to fill the row_id for me.

Thank you for the help!

So I did try to create a new ID column with auto-incrementing IDs and then changing the primary key to that column. As soon as that happened, the default value of the row changes to no default and I am stuck with the same problem again..
This is the settings of the column after assigning it as primary key:

So I got to a solution for this problem. It might be a bug in the auto-incremented ID columns. But it's possible to use an UUID column as primary key and then create a UUID for the new Rows updater like this:
image

Hello @Benjamin_Lammers!

Apologies you were having this issue with the ID and incrementing. It is tricky as with Retool DB all that logic is baked in.

So the bug is that you are able to change the primary key to be the UUID column that you created that you are able to increment properly?