code: async def execute(
          self,
          db_name,
          sql,
          params=None,
          truncate=False,
          custom_time_limit=None,
          page_size=None,
      ):
          
          page_size = page_size or self.page_size
  
          def sql_operation_in_thread(conn):
              time_limit_ms = self.sql_time_limit_ms
              if custom_time_limit and custom_time_limit < time_limit_ms:
                  time_limit_ms = custom_time_limit
  
              with sqlite_timelimit(conn, time_limit_ms):
                  try:
                      cursor = conn.cursor()
                      cursor.execute(sql, params or {})
                      max_returned_rows = self.max_returned_rows
                      if max_returned_rows == page_size:
                          max_returned_rows += 1
                      if max_returned_rows and truncate:
                          rows = cursor.fetchmany(max_returned_rows + 1)
                          truncated = len(rows) > max_returned_rows
                          rows = rows[:max_returned_rows]
                      else:
                          rows = cursor.fetchall()
                          truncated = False
                  except sqlite3.OperationalError as e:
                      if e.args == ('interrupted',):
                          raise InterruptedError(e)
                      print(
                          "ERROR: conn={}, sql = {}, params = {}: {}".format(
                              conn, repr(sql), params, e
                          )
                      )
                      raise
  
              if truncate:
                  return Results(rows, truncated, cursor.description)
  
              else:
                  return Results(rows, False, cursor.description)
  
          with trace("sql", (db_name, sql.strip(), params)):
              results = await self.execute_against_connection_in_thread(
                  db_name, sql_operation_in_thread
              )
          return results
docs: Executes sql against db_name in a thread