I want to do a simple POC for my team with a bar chart. I can write my SQL results to a table, but I want to see them in a Bar Chart but it displays nothing because of my bad syntax.
The table from st.write shows exactly what I want, only those 2 columns. The bar chart shows nothing.
Google has not been my friend! But I am sure this community can point me in the right direction!
Thanks!
SQL_Query:
select sum(registrant_id) as reg, created_at::date from domo_dev.lk_training.registrants group by created_at::date order by 2 limit 100’
As mentioned above, ‘st.write(SQL_Query)’ displays the results as a table
first column looks like a row number, second is ‘reg’ and third is that created at date.
Sorry for not including the SQL the first time around!
My guess is that those column names are not recognized. What do you get when you build the dataframe just as df = pd.DataFrame(SQL_Query) ? Does st.dataframe(df) shows a non-empty table that way?
When I try ‘df = pd.DataFrame(SQL_Query)’, then I see the correct results in my table.
Then I get this error:
streamlit.errors.StreamlitAPIException: reg (x parameter) was not found in the data columns or keys
UPDATE - I needed to capitalize the column names to match the table!
It works, thank you for the assistance !!!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.