SQL results to MS Teams using Python

Hi Team,
Have wrote a small python script to send results to MS teams , when am try to sending it coming as string format.
My Code:
import pymsteams
import pandas as pd
import numpy as np
import pyodbc
from tabulate import tabulate

server = ‘ServerName’
database = ‘DBName’
username = ‘username’
password = ‘pasword’
conn = pyodbc.connect(‘DRIVER={ODBC Driver 17 for SQL Server};SERVER=’+server+’;DATABASE=’+database+’;UID=’+username+’;PWD=’+ password)

cursor = conn.cursor()

sql_query = “select * from bookingStatusEnum”

df = pd.read_sql(sql_query, conn)

#print(tabulate(sql_query))
def sleeve(df):
df.to_html()

myTeamsMessage = pymsteams.connectorcard("my webhook url ")
myTeamsMessage.title(“List Of Booking Status”)
#myTeamsMessage.text(“Test Mail”)
myTeamsMessage.text(df.to_string())
myTeamsMessage.send()

Results:

I need results in table format. Please help on ASAP

Thanks

Hi Team,
Please help in this problem.

Hi Ram,

You have asked us to help with a problem, but haven’t told us what the
problem is. What is the problem?

If possible, show us the code you have written, otherwise you will need
to explain what you are trying to do.

Hi Steven,
Want to post SQL results to MS teams using python in table format.

Hi Ram,

You said:

“Want to post SQL results to MS teams using python in table format.”

What does this mean? What part are you having trouble with? What are “MS
teams”? Where is Python used? What sort of table format? Where does the
SQL results come from?

My answer would be:

  • export the results you want from SQL into the table format you want;

  • email the resulting file to the people on the MS team.

Do you know how to export data from SQL?

Do you know how send an email from Python?

We are volunteers, and not being paid to help. If we were consultants
charging you hundreds of dollars an hour, I am sure that we would be
more than happy to start with specifications that vague and charge you
thousands of doors in consulting fees to gather user-stories and
use-cases and write a specification, and that’s before writing a single
line of code.

But we’re not charging you for consulting, so if you want help, you
really need to be more specific about:

  • what you need to do
  • what you have tried
  • any errors you get

Good luck!

(P.S. I know nothing about SQL so I can’t help with that part.)