Generate internal links in dataframe

Hi all

I have a use case where I do some filtering on a dataframe to show me only the rows were a certain value is true. When I have filtered this out I would like to show a column with a link to another page in my multipage app, with some query parameters coming from the data table. The whole purpose is to make a table listing the errors of some processes, and then be able to click a link that will show some plots of the data from said process.

At the moment I make this by manually making the url string, with something like β€œhttp://localhost:8501/?query_params=Col1”. This is working okay with st.column_config.LinkColumn(), but what if for instance the port is not correct (not 8501) or I want to deploy to a local server with a dns record. How do I programmable get the domain name that is used in the instance of streamlit?

Edit: I acually just found the answer to the above question, I just need to make the link text, instead of making the link like β€œhttp://localhost:8501/?query_params=Col1”, I just make a link like β€œ/?query_params=Col1”. So a slash β€œ/” followed by my manually created query_params. I use the urllib.parse.qoute_plus() function for handling special characters from the column values.

Preferable, I would like to maybe have a st.column_config.PageLink(), working like the page_link function of course with the possibility to set the query parameters. For example the column could be the query parameters, either as a string column or a struct column.

For the page_link function there is an open issue for added query_params: support query params in st.page_link when using file path Β· Issue #8112 Β· streamlit/streamlit Β· GitHub.

Best regards Kristian