Adding new row to dash datatable changes dhe dtype of columns

When I add a new row into dash datatable and save it into to database, then all my columns dtype changes to object or string. How can I solve such a problem, because I have a large dataset with a lot of columns and don’t want the dtypes of columns to be changed!

# callback fo adding new row
    Output('our-table', 'data'),
    [Input('editing-rows-button', 'n_clicks')],
    [State('our-table', 'data'),
     State('our-table', 'columns')],
def add_row(n_clicks, rows, columns):
    if n_clicks > 0:
        rows.append({c['id']: '' for c in columns})

    return rows

The dtypes are changing because you are returning empty values for each column, which in turn changes the dtypes to objects.

If you want them to be blank, then don’t pass them into the database instead set defaults on the columns when saving if they are blank.

Or do validation on the table prior to saving to the database and change the dtypes accordingly.