Python table widget is not showing data from an SqLite3 cursor

Update: Got the window to be displayed including the widgets.

I left out this line of code in the class that was part of the original code before move it:


enter image description here

Original Question:

I'm new to Python and am currently following a beginner's tutorial series that was using PyQt5. I'm using PySide6. All of the coding that's shown is based on the tutorial coding. The purpose of the coding is to display a window using a table widget that gets loaded with data from an SqLite3 database cursor. I confirmed that there's data is actually in the cursor as shown in the screen shots, but this data is not displayed in the table widget. Instead, the table widget only shows row numbers on the left side with empty data cells.

Coding that's based on the tutorial:

from PySide6.QtWidgets import *
from PySide6.QtGui import *
from PySide6 import QtWidgets
from PySide6.QtCore import *
from PySide6 import QtCore
from PySide6.QtWidgets import QMainWindow
from PySide6.QtWidgets import QApplication

import sys
from os import path
from PySide6.QtUiTools import loadUiType

import sqlite3

folder_path = '/Users/emad-ud-deen/Development/Python/Practice/Real World Database App/'

FORM_CLASS, _=loadUiType(path.join(path.dirname('__file__'), folder_path + 'real_world.ui'))

class MainWindow(QMainWindow, FORM_CLASS):
    def __init__(self, parent = None):

#       super(MainWindow, self).__init__(parent)
#        QMainWindow.__init__(self)

    def HandleButtonClicks(self):

        # Assign a function to execute to the Refresh button.

    def ConnectAndGetDataFromTheDatabase(self):
        # Connect to SqLite3 database and fill the GUI with that data.
        the_database = sqlite3.connect(folder_path + 'parts.db')
        database_cursor = the_database.cursor()

        sql_command = ''' SELECT * from parts_table '''
        sql_command_result = database_cursor.execute(sql_command)


        # Fill the data into the table widget.
        for row_number, row_data in enumerate(sql_command_result):

            for column_number, data in enumerate(row_data):
                print('Row: ' + str(row_number) + ' Column: ' + str(column_number) 
                + ' Data: ' + str(data))

                self.tableWidget_inventory_details.setItem(row_number, column_number, 
                    QtWidgets.QTableWidgetItem(column_number, data))

#                self.tableWidget_inventory_details.setItem(row_number, column_number, 
#                    QTableWidget(str(data)))

def Main():
    app = QApplication(sys.argv)
    window = MainWindow()

if __name__ == '__main__':

Screen shots showing the database schema, the output showing data from the cursor enter image description here enter image description here enter image description here

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum