pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near

i faced this error whil am trying to fetch count of rows from data base to my filed called
total_paid_amount and it`s Data type is " Data "
here is my Query and code written in Custom Script client Side