Is it possible to disable retries on the `experimental_connection` query method?

Summary

I’m using a statement_timeout to prevent long running queries, but the query method retries the query 3 times.

Steps to reproduce

Code snippet:

self.conn = st.experimental_connection("db", type="sql", url=db_url)
with self.conn.session as session:
  session.execute(text("SET statement_timeout = '5s';"))
  session.commit()

self.conn.query("select pg_sleep(10);")

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

The query is not retried.

Actual behavior:

The query is retried 3 times.

Debug info

  • Streamlit version: 1.22.0
  • Python version: (3.11.3)

Links

The retry is done by this code: streamlit/sql_connection.py at 9a6ce804b7977bdc1f18906d1672c45f9a9b3398 · streamlit/streamlit · GitHub

I tried changing the retry options but they are in the protected method :cry:

I don’t see any obvious parameter for it and I don’t see a current GitHub issue. I think this would be a great feature request you could add to GitHub if you would like that.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.