title: Any way to pass operators <, <>, >= into sql-query?
body: <p>I have such piece of program:</p>
  <pre class="lang-py prettyprint-override"><code>if self.current_condition == 'comparison':
  comparison_command = '''SELECT * FROM {table} WHERE {pkey} &lt; %s'''
  cur.execute(sql.SQL(comparison_command).format(
                      table=sql.Identifier(self.current_table),
                      pkey=sql.Identifier(self.current_columns[0].text())
                  ), 
                  (self.comp_value, )
             )
  </code></pre>
  <p>What I want to do is write '&lt;' in command in the same way as {table} and {pkey}, that means I want to pass operators into command from variable. Can I do it?</p>
  <p><a href="https://i.stack.imgur.com/j94BI.png" rel="nofollow noreferrer">The face of the app looks like this</a>
  A little bit more of code context. It's an app, that should get data from database by sql-request, that creates from interface. As you can see, there's a bit more operators than one to choose.</p>
  <pre><code>    def run_func(self):
      conn = None
      try:
          conn = psycopg2.connect(
              host='localhost',
              database='1rl',
              user='postgres',
              password=passwor)
          cur = conn.cursor()
  
          if self.current_condition == 'comparison':
              comparison_command = '''SELECT * FROM {table} WHERE {pkey} &lt; %s'''
              cur.execute(sql.SQL(comparison_command).format(table=sql.Identifier(self.current_table),
                                                             pkey=sql.Identifier(self.current_columns[0].text())),
                                                              (self.comp_value, ))
              print(cur.fetchall())
  
      except (Exception, psycopg2.DatabaseError) as error:
          print(error)
      finally:
          if conn is not None:
              conn.close()
  
  
  def display(self, i):
      self.list_of_conditions.setCurrentIndex(i)
      self.current_condition = self.all_conditions[i]
      print(self.current_condition)
  
  
  
  def comp_value_changed(self):
      self.comp_value = self.value.text()
  
  def comp_on_selected(self):
      sender = self.sender()
      self.comp_selec = sender.text()
  
  def comparison_fun(self):
      layout = QFormLayout()
      compars = QHBoxLayout()
  
      for i in self.all_comparisons:
          temp = QRadioButton(i)
          temp.toggled.connect(self.comp_on_selected)
          compars.addWidget(temp)
  
      layout.addRow(QLabel('Operators'), compars)
  
      self.value = QLineEdit()
      self.value.textChanged.connect(self.comp_value_changed)
      layout.addRow(&quot;Value&quot;, self.value)
  
      rune = QPushButton('Run')
      rune.clicked.connect(self.run_func)
      layout.addRow(rune)
      self.comparison.setLayout(layout)
  </code></pre>