docs: def export_from_db(output_key, calc_id, datadir, target):
      """
      :param output_key: a pair (ds_key, fmt)
      :param calc_id: calculation ID
      :param datadir: directory containing the datastore
      :param target: directory, temporary when called from the engine server
      :returns: the list of exported path names
      """
      makedirs(target)
      export.from_db = True
      ds_key, fmt = output_key
      with datastore.read(calc_id, datadir=datadir) as dstore:
          dstore.export_dir = target
          try:
              exported = export(output_key, dstore)
          except Exception:
              etype, err, tb = sys.exc_info()
              tb_str = ''.join(traceback.format_tb(tb))
              version = check_version(dstore)
              raise DataStoreExportError(
                  'Could not export %s in %s%s\n%s%s' %
                  (output_key + (version, tb_str, err)))
          return exported