Summary
We are trying to place SQL result data into tabular format using st.dataframe / st.table on Azure Web Application. Tabular results are coming in one single row (suppose all 10 rows into one single header row) in horizontally. But on localhost it is working as expected like all 10 rows placed in tabular format.
Steps to reproduce
Code snippet:
Issue Code:
lines = re.split(r"\r\n", result_str)
columns = lines[0].split(delimiter) #Column header
data_rows = []
for line in lines[1:]:
values = line.split(delimiter)
data_rows.append(values)
res_df = pd.DataFrame(data_rows, columns=columns)
st.table(res_df)
Working code:
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';Authentication=ActiveDirectoryMsi')
dataframe = pd.read_sql(query, cnxn)
cnxn.close()
st.table(dataframe)
Reading SQL result into string variable and create dataframe using pd.Dataframe is not working as expected. But when we are reading using pd.read_sql(query,cnxn) able to plot in st.dataframe / st.table.
Expected behavior:
Both code should able to plot table in Azure Web Application.
Actual behavior:
Both code working as expected in localhost