I am trying to edit an exisiting dataframe and then writing it to a database. The dataframe gets sent to the database (editable_df), but without the edits.
def edit_data(editable_df, key):
with st.expander(key):
with st.form('edit'):
grid_return = AgGrid(editable_df, editable=True, theme ='streamlit')
new_df = grid_return['data']
st.form_submit_button('confirm', on_click=sent_to_db(new_df))
def sent_to_db(new_df):
new_df.to_sql(name = 'table', con = conn, if_exists = 'replace')
Greatly appreciate the help!