SELECT DISTINCT
    diffSkyfile.diff_id,
    diffSkyfile.skycell_id,
    diffSkyfile.uri,
    diffSkyfile.path_base
FROM magicDSRun
JOIN magicRun USING(magic_id)
JOIN magicInputSkyfile USING(magic_id, diff_id)
JOIN diffSkyfile
    ON magicInputSkyfile.diff_id = diffSkyfile.diff_id
    AND magicInputSkyfile.node = diffSkyfile.skycell_id
JOIN diffInputSkyfile
    ON diffInputSkyfile.diff_id = diffSkyfile.diff_id
    AND diffInputSkyfile.skycell_id = diffSkyfile.skycell_id
    -- Want input warps only
    AND diffInputSkyfile.warp1 IS NOT NULL
JOIN warpSkyCellMap
    ON warpSkyCellMap.warp_id = diffInputSkyfile.warp1
    AND warpSkyCellMap.skycell_id = diffInputSkyfile.skycell_id
JOIN warpSkyfile
    ON warpSkyfile.warp_id = warpSkyCellMap.warp_id
    AND warpSkyfile.skycell_id = warpSkyCellMap.skycell_id
    AND warpSkyfile.ignored = 0
WHERE
    diffSkyfile.fault = 0
    AND magic_ds_id = %lld
