title: how to use parameters, including integer, float and string, when using sql in python?
body: <p>I am trying to use SQL in Python to extract data. </p>
  
  <p>It works fine when it is a simple query like: </p>
  
  <pre><code>query="""
        SELECT OBJECTID
        FROM ACTIVITY
        """
  a=cursor.execute(query)
  </code></pre>
  
  <p>But when I try to put a number in it, then it will have an error:</p>
  
  <p><a href="https://i.stack.imgur.com/Tkhin.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tkhin.png" alt="enter image description here"></a></p>
  
  <p>And the same error also happen when i try LIMIT, ROWNUM etc. It looks like I cannot just put a number in the code like this.</p>
  
  <p>I also tried this way:</p>
  
  <p><a href="https://i.stack.imgur.com/BRFpE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BRFpE.png" alt="enter image description here"></a></p>
  
  <p>But the same error occured.</p>
  
  <p>Also, I tried: </p>
  
  <pre><code>query="""
        SELECT TOP %s OBJECTID
        FROM ACTIVITY
        """
  num = 5
  a=cursor.execute(query, num)
  </code></pre>
  
  <p>But I have got this:</p>
  
  <p><a href="https://i.stack.imgur.com/t3yCm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t3yCm.png" alt="enter image description here"></a></p>
  
  <p>So, i want to know how to transfer integers, floats and strings into sql in Python like parameters?</p>