r/learnpython • u/Brothercford • May 13 '21
Sharing my win.
I work in global supply chain and logistics for a project management group of a global apparel company. I’m considered the tech guy on the team and the data nerd. I manage projects and handle all reporting, automation, etc. pretty fun stuff.
Well, today I did something that saved us 12 hrs of delay in execution in our supply chain by writing a script that pulls data from GCP out to an oracle db and then execute sequential sql statements to transform the data and refresh tables that feed tableau dashboards. It all now takes less than 20 minutes via a batch file in the background.
Millions of rows of data for three specific tables, tons of calculations, etc.
Python confidence is way up folks and it’s due to the knowledge sharing that is to be had in this group and others dedicated to the art of Python.
Felt like I should share my lessons learned.
I need to get better at testing
CLOB sucks so utilize sqlalchemy types for varchar
Tnsnames are not hard
64 bit memory usage trumps 32 bit on large datasets
Chunk size is a godsend.
Cheers to you.
2
u/open_risk May 14 '21
20 minutes sounds quite a lot :-) How big is the dataset and where is the bottleneck (network, db/disk i/o, compute?). Next task: bring it down to 2min :-) :-). If its compute time i'd focus on the pandas bit...
Just kidding you, great to share examples of solving real problems using python. Speed is just one dimension btw, increasing confidence in the process is important too (documenting data quality, informative good looking reports etc.) and python has plenty of options on that front as well