Hi,
I’m implementing an app with a st.form that allows users to update data of a given table in Snowflake. Once a new row is created, the timestamp of that moment must be filled in a audit column.
The source table has the column casted as TIMESTAMP_NTZ(9), where 9 is the precision (I don’t need it to be so precise, just hh:mm:ss is fine).
In the script bellow I try do update a df and the behavior is the same: I click submit and the new row simply disappears. Can you help me finding a solution for this?
# Import python packages
import streamlit as st
import pandas as pd
from datetime import datetime
now = datetime.now()
df = pd.DataFrame(
[
{"col1": "A", "tmstmp": now},
{"col1": "B", "tmstmp": now},
{"col1": "C", "tmstmp": now},
]
)
with st.form("DF"):
df = st.data_editor(df,num_rows="dynamic",column_config={
"col1": st.column_config.TextColumn(
"col1",
default='Z'
),
"tmstmp": st.column_config.DatetimeColumn(
"tmstmp",
default=now,
disabled=True
)
})
submit_button = st.form_submit_button("Submit")
if submit_button:
st.success("Success")