So, I am running a query in SQL to extract to the data from the database and putting it inside a card the number of rows it has.(count of it)
I want to make a download button as the card footer and download the Dataframe with the required details.
But the thing is , I want to load the data inside the card first (the count of rows) and then show the download button in the card footer so the user can download the necessary details. ( Also need a loader until the SQL query runs in the background)
How do I do that ? Please help me with this .
The source code is :
def ticket():
issues = pd.read_sql(f"""
SELECT * FROM issues.ticket;
""", engine)
return ticket
card = dbc.Card(
[
dbc.CardHeader(
[
html.H6("This Week's Tickets", className="mb-0",
style={'font-size': '12px', 'text-align': 'center'})
],
className="border-0 center",
style={"background-color": "#A6E3E9"}
),
dbc.CardBody(
[
html.Img(src='assets/tickets.png',
style={'height': '24px', 'width': '24px', 'margin-right': '10px'},
alt='icon', className='img-fluid'),
# html.H3("25", className="card-title"),
],
className="border-0 d-flex align-items-center"
),
dbc.CardFooter(
dbc.Row(
[
],
align="center"
)
)
],
style={"height": "330px", "border-radius": "10px", "background-color": "#E3FDFD",
"box-shadow": "1px 2px 7px 0px grey"},
className="border-0"
)