python ошибка в select
@app.route('/emp/<int:id>')
def emp(id):
try:
conn = mysql.connect()
cursor = conn.cursor(pymysql.cursors.DictCursor)
cursor.execute("""SELECT
id
DATE_FORMAT(date,"%d.%m.%Y") as date,
TIME_FORMAT(time,"%H:%i") as time,
FROM table
WHERE id= %s AND date = (SELECT curdate())""", id)
empRow = cursor.fetchall()
respone = jsonify(empRow)
respone.status_code = 200
return respone
except Exception as e:
print(e)
finally:
cursor.close()
conn.close()
Ошибка %d format: a number is required, not str
Понятно, что он пытается подставить переменную d в формат даты. вопрос, как это обойти?
если использую в select поле time возникает ошибка
Object of type timedelta is not JSON serializable