title: Check row exists in MySQL through function in python class
body: <p>I am trying to implement a function in my database manager class that checks if a row (user) exists (through their email) in my MySQL table.</p>
  <p>See code below:</p>
  <pre><code>def has_user(self, table_name : str, user_credentials: UserCredentials) -&gt; bool:
          mysql_hasuser_query = &quot;&quot;&quot;
          SELECT COUNT(1) FROM {t_name} WHERE email = {u_email}
          &quot;&quot;&quot;.format(t_name=table_name, u_email=user_credentials.email)
  
          cursor = self.connection.cursor()
          cursor.execute(mysql_hasuser_query)
          if cursor.fetchone()[0]:
              print(&quot;User exists in database!&quot;)
              return True
  </code></pre>
  <p>I am receiving the following syntax error <code>mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@gmail.com' at line 1</code></p>
  <p>However, I implemented this in MySQL query editor and it worked fine. I am not sure what I am doing wrong here.</p>