SELECT
    magicInputSkyfile.*,
    diffSkyfile.uri
FROM magicRun
JOIN magicInputSkyfile
    USING(magic_id)
JOIN diffSkyfile
    ON magicInputSkyfile.diff_id = diffSkyfile.diff_id
    AND magicInputSkyfile.node = diffSkyfile.skycell_id
WHERE
    magicRun.state = 'run'
