This week’s challenge is another Streamlit challenge, we want you to produce an interface where you can upload files into whichever table is selected.
You will find your setup code here
create schema <enter_db_name_here>.world_bank_metadata;
create or replace table <enter_db_name_here>.world_bank_metadata.country_metadata
(
country_code varchar(3),
region string,
income_group string
);
create schema <enter_db_name_here>.world_bank_economic_indicators;
create or replace table <enter_db_name_here>.world_bank_economic_indicators.gdp
(
country_name string,
country_code varchar(3),
year int,
gdp_usd double
);
create table <enter_db_name_here>.world_bank_economic_indicators.gov_expenditure
(
country_name string,
country_code varchar(3),
year int,
gov_expenditure_pct_gdp double
);
create schema <enter_db_name_here>.world_bank_social_indiactors;
create or replace table <enter_db_name_here>.world_bank_social_indiactors.life_expectancy
(
country_name string,
country_code varchar(3),
year int,
life_expectancy float
);
create or replace table <enter_db_name_here>.world_bank_social_indiactors.adult_literacy_rate
(
country_name string,
country_code varchar(3),
year int,
adult_literacy_rate float
);
create or replace table <enter_db_name_here>.world_bank_social_indiactors.progression_to_secondary_school
(
country_name string,
country_code varchar(3),
year int,
progression_to_secondary_school float
);
Unfortunately, basic Python knowledge is essential for this week. But, it’s nothing a quick beginner’s course couldn’t quickly teach you!
You can find the data here, and the FF logo here.
RESULT
Remember if you want to participate:
- Sign up as a member of Frosty Friday. You can do this by clicking on the sidebar, and then going to ‘REGISTER‘ (note joining our mailing list does not give you a Frosty Friday account)
- Post your code to GitHub and make it publicly available (Check out our guide if you don’t know how to here)
- Post the URL in the comments of the challenge.
You can also sign up to our mailing list below.
7 responses to “Week 12 – Intermediate”
-
Interesting, it taught me a lot.
Solution URL – https://github.com/mateusz-kmon/frostyfridaychallenges/blob/main/w12.py -
I was delayed this time due to a busy weekend, however this was a fun challenge to come back to!
I cheekily replaced the logo with the IW one, but other than this I think my solution matches the brief. I chose to leverage Snowpark to directly write the Pandas dataframes for the uploaded files into the tables in Snowflake, which was also fun.
- Solution URL – https://github.com/ChrisHastieIW/Frosty-Friday
-
A lot of lessons learned today…
https://www.loom.com/share/abe59f752fe84bef970050810f1b2572My approach:
1. use a dbt model to create the tables needed
2. create the streamlit app
– sidebar
– hardcode schemas
– retrieve tables from information_schema
– file uploader
– show a preview of the data
– submit to upload to SF and show the response if successfulTook me a looong time to get the “write pandas” to work
- Solution URL – https://github.com/dsmdavid/frostyfridays-sf/blob/main/extra/ch_12_streamlit.py
-
Very nice challenge, it was quite easy to build this useful small app with Streamlit!
- Solution URL – https://github.com/pekka-kanerva/frosty-friday/blob/main/week12/ff-week12-file-uploader.py
-
Given a bit of twist. Have provided user selection for database as well, along with schema and table
- Solution URL – https://github.com/mandarha/ff.git
-
🙂
- Solution URL – https://github.com/darylkit/Frosty_Friday/blob/main/Week%2012%20-%20Streamlit/streamlit.py
-
I tried it with the SHOW command.
- Solution URL – https://github.com/tampopo7/frostyfriday/blob/main/frostyfriday_week12_CsvUpload.py
Leave a Reply
You must be logged in to post a comment.