Tuesday, January 10, 2023

Generate PowerPoint slides from your Db2 data with Python

Generated PowerPoint slide with Db2 data
How did you spend the holidays? I had some days off and then used the last day of vacation for some fun programming. Last year, I wanted to test the python-pptx package, but couldn't find time. So I used my "fun day" to generate / code up some PowerPoint slides. To make it more interesting, I added some charts from data retrieved from Db2 in my IBM Cloud account. Here is a quick recipe.


Use the following Python packages:


Install the required Python packages, copy the sample code for creating a line chart. Implement a small function to create the Db2 engine in SQLAlchemy, connect to a Db2 database, execute a SELECT statement and retrieve the data. Call that function and feed the data to the line chart.


Some fun to begin the year, some new experience, and maybe a new talk at one of the upcoming IDUG conferences or DeDUG meetings.

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik), Mastodon (@data_henrik@mastodon.social), or LinkedIn.