MYSQL as an API Enhance Step

  1. What is your feature/integration request? To include the MY SQL feature as an API Enhance with {column} variables applied in the advanced query function.
  2. What problem would this feature/integration solve?
    I have historical sales data and need to get select information by mysql query for various reports. Instead of importing the entire 300,000 line table, I’d like to grab just the orders from a certain customer, or just the items sold between select dates.
  3. How do you solve/workaround this problem today? Huge imports, if I had the skill I’d create a middleware API using bash, python, php but… that means at least 40 hours of undisturbed time that I don’t have.

I haven’t heard much on this so… Using a google vm running Ubuntu Linux and Apache, I created a quick and easy PHP script that translates a mysql query into json so that it can be used as an API enhance step. The code is below

 parse_str($_SERVER["QUERY_STRING"]);


 $conn =  mysqli_connect($host,$user,$pass,$dbase);

     if(! $conn ){
        die('Could not connect: ' . mysqli_error());
     }
     echo '';
     $source = $dbase.'.'.$table;
     $selected = $select;
     $orderby = $arrange;
     $order = $arrangeby;
     $search = $query;

 $data = $conn->query("select $selected from $source where $search order by $orderby $order");


 $rows = array();
 while($r = mysqli_fetch_assoc($data)) {
$rows[ ] = $r;
 }
print json_encode($rows)

I am open to suggestions for simplifying the query parameters… Pretty new to MYSQL.