def many_birthday():
with connection.cursor() as cursor:
cursor.execute(f"SELECT * FROM bday WHERE BDAY LIKE '%{format_day}%'")
rows = cursor.fetchall()
a = []
for row in rows:
a.append(' '+row["LAST_NAME"] + " " + row["FIRST_NAME"] + ", \n `" + row["DEPARTMENT"] + "` \n")
return a
connection.commit()
Этот скрипт тебе поможет вывести несколько пользователей из бд sql
def many_birthday():
a = []
for i in BOT_CONFIG:
day = i['BDAY']
format_d = day[5:]
if format_d == format_day:
a.append(' *' + i["LAST_NAME"] + " " + i["FIRST_NAME"] + "* \n `" + i["DEPARTMENT"] + "` \n")
return a
Этот из json файла