Adding tabular data to PDF file from different data sources like SQLite, MySQL student table



Adding tabular data to PDF file from different data sources like SQLite, MySQL student table

Adding tabular data to PDF file from different data sources like SQLite, MySQL student table

We can connect to different data sources to collect data and display in tabular format inside a PDF document.
In part 4 we learnt about basics of adding tabular data to PDF file with various options and styles.

While using the table the data source is taken from a file where we have a list with 35 rows of records.
We can change the source of the data by keeping our main code to create the table same.
Here the variable my_data is used and the value for this variable is taken from different data sources.
We create one connection string to connect to SQLite Database and execute the query to collect a set of records of the student table.
This connection string can be changed to MySQL database.
First we will execute the query to get a record set and then we call all column heads by using the keys() method.
We will create one list by using fetchall() and then we will append each row of data to our main variable my_data.
This variable my_data is used to create our table in pdf document.

Download the source code from here.
https://www.plus2net.com/python/pdf-table.php

Part 1 Creating PDF file and adding text, line , images , water mark etc
https://youtu.be/YOQvnhPEPUU

Part 2 Generate PDF Mark sheet of students using data from SQLite or MySQL table
https://youtu.be/0u1X2ZxMdVY

Part 3 PDF Invoice generation in Python
https://youtu.be/zPaK6Y3qWoc

Part 4 Adding table to PDF file
https://youtu.be/n7Ive256tPE

Part 5 Adding database table data to PDF file
https://youtu.be/Ol2odysiXyg

Part 6 Adding Pandas DataFrame data to PDF file
https://youtu.be/gQRMlPS-C6g

Part 7 Adding shapes like circle, rectangles
https://youtu.be/zDCQUG90viI

Part 8 Adding bar charts
https://youtu.be/hqfj6aXDCfA

Part 9 Adding line charts
https://youtu.be/mwn6RRJcg9Y

Part 10 Adding Pie Charts
https://youtu.be/-JzdoXKWf-I

Part 11 Adding Paragraph
https://youtu.be/LpOjsJ0VZTc

Part 12 Creating PDF reports
https://youtu.be/EOBMENTLgv4

#MySQLdataInPDF #SQLiteDataPDF #PDFdataSources #DataSourceIncreatingPDFTable #python #reportLab #plus2net #fetchall

Comments are closed.