Basically, you want to run some php code to import an SQL database dump from a file.  There is code that does this in the implementation of `drush sql-sync`.  It looks like [this][1]:

      $options = $global_options + $target_options + array(
        'file' => $destination_dump_path,
        'file-delete' => TRUE,
      );
      $return = drush_invoke_process($destination, 'sql-query', array(), $options, $backend_options);
      if ($return['error_status']) {
        // An error was already logged.
        return FALSE;
      }

You could also call `drush sql-sync` with appropriate options for a more full-featured solution (e.g. if you want to import a local database to a remote site).  For an import to a local site, though, it is more straightforward to simply use the snippet above, which essentially runs `drush sql-query --file=/path/to/dump.sql`.

  [1]: https://github.com/drush-ops/drush/blob/8.0.0-rc3/commands/sql/sqlsync.drush.inc#L266