Data from the database not showing in the DashTable


I currently have a Dash table that is displaying data from a database, the current table is also able to add a new row into the table.

The problem that I am having is that the table is currently blank and is not showing the information from the database: Below is the example code:

import dash
from dash import dash_table
from dash import html,dcc
from dash import Output, Input,State
import pandas as pd
p_idx =“testing”

def onLogin(app, Date):
columns = [‘id’,‘b’,‘c’,‘d’]
rows = [[‘AA’+str(i),‘BB’+str(i),‘CC’+str(i),‘DD’+str(i)] for i in range(1,5)]
df = pd.DataFrame(columns = columns, data=rows)
return True,columns,df.to_dict(‘records’),‘ALL’,True

def getDefRows(rows,num, Date):
return rows[0]

def create_form(app,pathname,bl_ids,def_row):
return html.Div(“Form”)
def creat_layout(app):
layout = html.Div([dcc.Location(id=‘url’, refresh=False),
html.Button(‘Submit’, id=‘editing-rows-button’, n_clicks=0),
html.Div(id=p_idx + “mainTable”, children= “”)])
return layout

def createDashTable(columns, rows):
return dash_table.DataTable(
id=p_idx + ‘row_table’,
columns= [{
‘name’: c,
‘id’ : c,
‘deletable’: True,
‘renamable’: True
} for c in columns],
data= rows,

def MasterCalls(app):
@app.callback([Output(p_idx+‘ph’, ‘children’),
Output(p_idx+“mainTable”, ‘children’)],
[Input(‘url’, ‘href’)])
def display_page(pathname):
COBDate = “”
if “=” in pathname:
pathname = pathname.split("=")[-1]
Date = str(pathname).upper()
isAuthorised, columns, rows, bids,isAll = onLogin(app, Date)
if isAuthorised:
def_row = getDefRows(rows,-1, Date)
form = create_form(app,pathname,bids,def_row)
return , createDashTable(columns, rows)

	return form, createDashTable(columns, rows)

		Output(p_idx + "row_table", 'data'),
		  [Input('editing-rows-button', 'n_clicks')],
		  [State(p_idx + "row_table", 'data'),
		   State(p_idx + "row_table", 'columns')])
def add_row(n_clicks, rows, columns):
	if n_clicks > 0:
	   rows.append({c['id']: 'TEST' for c in columns})
	return rows

if name == ‘main’:
app = dash.Dash()
app.layout = creat_layout(app)
app.config.suppress_callback_exceptions = True