Skip to content

Commit 85e8ae1

Browse files
committed
Worked on days_to_million dashboard
1 parent 70f88ef commit 85e8ae1

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed
File renamed without changes.

bi_tv_dashboards/readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This app is meant for building dashboards for big TV screens.
2+
Days_to_Billion: this dashboard shows how long it has taken us to earn two billion dollars.

bi_tv_dashboards/scripts/setup.sql

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-- Setup script for the bi_tv_dashboards application.
2+
3+
CREATE APPLICATION ROLE bi_tv_dashboards__app_role;
4+
CREATE SCHEMA IF NOT EXISTS core;
5+
GRANT USAGE ON SCHEMA core TO APPLICATION ROLE bi_tv_dashboards__app_role;
6+
7+
CREATE OR ALTER VERSIONED SCHEMA code_schema;
8+
GRANT USAGE ON SCHEMA code_schema TO APPLICATION ROLE bi_tv_dashboards__app_role;
9+
10+
CREATE VIEW IF NOT EXISTS code_schema.REPORT__DAYS_TO_BILLION__VELOCITY__VIEW AS
11+
SELECT
12+
*
13+
FROM
14+
shared_data.REPORT__DAYS_TO_BILLION__VELOCITY__VIEW
15+
;
16+
17+
GRANT SELECT ON VIEW code_schema.REPORT__DAYS_TO_BILLION__VELOCITY__VIEW TO APPLICATION ROLE bi_tv_dashboards__app_role;
18+
19+
20+
CREATE STREAMLIT code_schema.Days_to_Two_Billion__Streamlit
21+
FROM '/streamlit'
22+
MAIN_FILE = '/days_to_billion.py'
23+
;
24+
25+
GRANT USAGE ON STREAMLIT code_schema.Days_to_Two_Billion__Streamlit TO APPLICATION ROLE bi_tv_dashboards__app_role;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Import python packages
2+
import streamlit as st
3+
from snowflake.snowpark.context import get_active_session
4+
5+
# Write directly to the app
6+
st.title("Days to $2 Billion")
7+
8+
# Get the current credentials
9+
session = get_active_session()
10+
11+
tableName = 'code_schema.REPORT__DAYS_TO_BILLION__VELOCITY__VIEW'
12+
queried_data = session.table(tableName)
13+
14+
days = queried_data.select(queried_data["DAYS"])
15+
16+
hours = queried_data.select(queried_data["HOURS"])
17+
18+
minutes = queried_data.select(queried_data["MINUTES"])
19+
20+
# Display the Pandas data frame as a Streamlit data frame.
21+
st.text(f'{days} DAYS {hours} HOURS {minutes} MINUTES')

0 commit comments

Comments
 (0)