Postgresql Plpgsql Loop Through Json Python Scripting Interview