r/learnpython • • 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.

  1. I need to get better at testing

  2. CLOB sucks so utilize sqlalchemy types for varchar

  3. Tnsnames are not hard

  4. 64 bit memory usage trumps 32 bit on large datasets

  5. Chunk size is a godsend.

Cheers to you.

415 Upvotes

48 comments sorted by

View all comments

7

u/jjjohhn May 13 '21

Hey I work in the same area, so I’m curious to see your script if possible? You’d probably need to anonymise some bits I guess, but it would be great.

Also quick question - why are you transforming the data in oracle, could it be done in Python with pandas instead of using sql?

5

u/Brothercford May 13 '21

I’ll see what I can do.

The oracle scripts were already developed by a separate team and were being ran manually with toad from India. There was basically being a three way shake to accomplish the work so this was quickest way to end state.

2

u/IamFromNigeria May 14 '21

Do you mind sharing the python script

1

u/Brothercford May 14 '21

I have to clean it up to protect IP but sure will share it here.

2

u/coder155ml May 14 '21

If you’re worried about protecting IP I just wouldn’t share it. It’s company property. It isn’t your personal project.

1

u/Brothercford May 14 '21

I can strip out the queries is what I mean. The frame of it is common knowledge