Hi everyone,
I am trying to run the following function for creating the user account and then storing the credentials in the sql db using the st.connection
method as follows:
def signup(container: any):
email = container.text_input("enter your registeration email", type="default")
password_input = container.text_input("enter your password", type="password")
password_confirm = container.text_input("confirm your password", type="password")
signup_button = container.button("Signup", key="signup_button")
if not st.session_state.signup and password_input == password_confirm:
st.info("creating account")
demo_details = ['documents','0xdemo']
create_table = "CREATE TABLE IF NOT EXISTS `login` (`email` VARCHAR(60), `space_name` varchar(128), `password` varchar(256), `account_key` VARCHAR(256), PRIMARY KEY (email) ) "
query_details = "INSERT INTO `login` (`email`, `space_name`, `password`, `account_key`) VALUES (:email, :space_name, :password, :account_key)"
##INSERT INTO `login` (`email`, `space_name`, `password`, `account_key`) VALUES ('{email}', {demo_details[0]}, {password_input}, {demo_details[1]})
conn.query(text(query_details),email=email,space_name=demo_details[0],password= password_input, account_key= demo_details[1])
##.....
and the error trace is :
UnhashableParamError: Cannot hash argument 'sql' (of type sqlalchemy.sql.elements.TextClause) in '_query'.
To address this, you can tell Streamlit not to hash this argument by adding a leading underscore to the argument's name in the function signature:
@st.cache_data
def _query(_sql, ...):
...
The version of streamlit is 1.31.1 and the runtime is aws linux ubuntu 20.04
version. can you also give me example of another way to create the signup form ? given that I even tried the method st.connection.Session.execute()
method but it also gives error that session() method is not callable
.
thanks for help